/* ============ Writings Page (scoped) ============ */
.writings-page { color: #1d1d1f; background: #F9F8F4; }

/* top section: title + subtitle */
.writings-page .writings-hero { max-width: 900px; margin: 80px auto; padding: 60px 20px 0 20px; border-top: 1px solid #eee; }
.writings-page .writings-title { font-size: 2.25rem; font-weight: var(--font-bold); line-height: 1.12; letter-spacing: -0.015em; margin: 0 0 12px; }
.writings-page .writings-sub { font-size: 1rem; color: #444; margin: 0; }

/* posts list section */
.writings-page .writings-list { max-width: 900px; margin: 24px auto 120px; padding: 0 20px; }
.writings-page .post-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }

/* Apple/Medium-like card */
.writings-page .post-card { position: relative; border-bottom: 1px solid #eaeaea; padding: 18px 2px 22px; transition: transform .18s ease, border-color .18s ease; }
.writings-page .post-card:hover { transform: translateY(-1px); border-color: #d9d9d9; }
.writings-page .post-link { display: block; text-decoration: none; color: inherit; border-radius: var(--radius-sm); }
.writings-page .post-link:focus-visible{
  outline: 2px solid var(--ink);
  outline-offset: 4px;
}

.writings-page .post-title { font-size: 1.25rem; font-weight: var(--font-bold); letter-spacing: -0.01em; line-height: 1.25; margin: 0 40px 6px 0; }

.writings-page .post-meta { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; font-size: .9rem; color: #666; margin: 0 0 8px; }
.writings-page .post-meta time { white-space: nowrap; }
.writings-page .dot { width: 3px; height: 3px; border-radius: 50%; background: currentColor; opacity: .6; display: inline-block; }

.writings-page .post-excerpt { color: #333; margin: 0; line-height: 1.55; }

/* subtle external arrow */
.writings-page .post-link[rel~="external"]::after { content: ""; position: absolute; right: 0; top: 22px; width: 16px; height: 16px; mask: url('data:image/svg+xml;utf8,<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 24 24\"><path fill=\"%23000\" d=\"M14 3h7v7h-2V6.41l-9.29 9.3-1.42-1.42 9.3-9.29H14V3Zm5 18H3V5h8V3H3a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-8h-2v8Z\"/></svg>') no-repeat 50% 50%; background: #9a9a9a; opacity: .9; }

/* tags */
.writings-page .tags { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.writings-page .tag { font-size: .8rem; padding: 3px 8px; border: 1px solid #e6e6e6; border-radius: var(--radius-pill); color: #555; }

/* subtle fade-in on load (works with core.js mountFades) */
.writings-page [data-fade] { --fade-y: 24px; --fade-dur: .8s; }

/* responsive tweaks */
@media (max-width: 640px) {
  .writings-page .writings-hero, .writings-page .writings-list { margin: 56px auto; }
  .writings-page .writings-title { font-size: 1.9rem; }
  .writings-page .post-title { font-size: 1.1rem; margin-right: 28px; }

}
/* =================== GRID LAYOUT (desktop) =================== */
.writings-grid{
  max-width: 900px;
  margin: 0 auto 96px;
  padding: 0;
}

/* =================== SQUARE MEDIUM CARD =================== */
/* knobs */
.medium-card{
  --card-size: 220px;   /* square side length */
  --radius: var(--radius-xl);       /* corner radius */
  --pad: 20px;          /* inner spacing (for text) */
  --lift-card: -4px;    /* hover lift distance */

  position: fixed;
  top: 200px; /* adjust if navbar height changes */
  left: calc(50% - 900px/2 - var(--card-size) - 35px); /* 40px gap from content column */

  width: var(--card-size);
  height: var(--card-size);
  border-radius: var(--radius);
  overflow: hidden;
  background: rgba(255,255,255,.72);
  border: 1px solid rgba(0,0,0,.08);
  backdrop-filter: var(--backdrop-saturate-high) var(--backdrop-blur-md);
  -webkit-backdrop-filter: var(--backdrop-saturate-high) var(--backdrop-blur-md);
  box-shadow:
    0 1px 0 rgba(0,0,0,.04),
    0 10px 24px rgba(0,0,0,.08);
  transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease;
  z-index: 10;
}

.medium-card__link{
  position: relative;        /* stacking context for inner layers */
  display: block;
  width: 100%;
  height: 100%;
  border-radius: inherit;
  color: inherit;
  text-decoration: none;
}

/* --- LAYER ORDER (top → bottom): text(3) > image(2) > glass(1) --- */

/* Background glass (behind image) */
.medium-card__glass{
  position: absolute;
  inset: 0;
  border-radius: inherit;
  z-index: 1;
  background:
    radial-gradient(120% 100% at 0% 0%, rgba(255,255,255,.95) 0%, rgba(255,255,255,.7) 45%, rgba(255,255,255,.6) 100%),
    linear-gradient(180deg, rgba(255,255,255,.12), rgba(255,255,255,0));
  pointer-events: none;
}

/* Image fills the entire card so image+button appear as one */
.medium-card__img{
  position: relative;
  z-index: 2;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: inherit;
}

/* Text overlay (optional; sits above image) */
.medium-card__body{
  position: absolute;
  left: var(--pad);
  right: var(--pad);
  bottom: var(--pad);
  display: grid;
  gap: 4px;
  z-index: 3;
}

.medium-card__title{
  font-size: 1.05rem;
  font-weight: var(--font-bold);
  letter-spacing: -0.01em;
  color: #1d1d1f;
}

.medium-card__handle{
  font-size: .88rem;
  color: #2b2b2e;
  opacity: .85;
}

.medium-card__cta{
  font-size: .92rem;
  color: #007aff;
}

/* Hover: card (and image with it) lifts together */
.medium-card:hover{
  transform: translateY(var(--lift-card));
  box-shadow:
    0 2px 0 rgba(0,0,0,.05),
    0 18px 36px rgba(0,0,0,.12);
  border-color: rgba(0,0,0,.12);
}

/* External arrow – always on top */
.medium-card__link[rel~="external"]::after{
  content:"";
  position: absolute;
  top: 12px; right: 12px;
  width: 16px; height: 16px;
  background: #9a9a9a;
  opacity: .9;
  z-index: 4;
  mask: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path fill="%23000" d="M14 3h7v7h-2V6.41l-9.29 9.3-1.42-1.42 9.3-9.29H14V3Zm5 18H3V5h8V3H3a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-8h-2v8Z"/></svg>') no-repeat 50% 50%;
}

/* reduced motion */
@media (prefers-reduced-motion: reduce){
  .medium-card, .medium-card *{ transition: none !important; }
}

/* =================== Compact footer card (mobile) =================== */
.medium-card--compact{
  display: none;
  position: static;
  margin: 0 auto 96px;
  width: min(640px, 92vw);
  height: 120px;               /* horizontal compact card */
  --pad: 16px;
}
.medium-card--compact .medium-card__body{
  left: calc(var(--pad) + 64px);
  right: var(--pad);
  bottom: calc(var(--pad) + 10px);
}

/* =================== Responsive =================== */
@media (max-width: 1200px){
  /* hide fixed overlay when the viewport is too narrow */
  .writings-page .medium-card{ display:none; }
}
@media (max-width: 960px){
  .writings-grid{ margin:0 auto 56px; }
  .medium-card--compact{ display:block; }
}
