* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
  color: #1b1b1a;
  background: #ecebe7;
  -webkit-font-smoothing: antialiased;
}
::selection { background: #a9edf0; }

button, input, select, textarea { font-family: inherit; }
a { color: inherit; }

@keyframes ovIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes mdIn { from { opacity: 0; transform: translateY(32px) scale(.965); } to { opacity: 1; transform: none; } }
@keyframes mdBodyIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

/* ---------- layout shell ---------- */
.jw-shell {
  display: flex;
  align-items: flex-start;
  min-height: 100vh;
  background: #ecebe7;
}

.jw-hamburger {
  display: none;
  position: fixed;
  top: 24px; left: 24px;
  z-index: 72;
  width: 46px; height: 46px;
  border: none;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 8px rgba(0,0,0,.1);
  cursor: pointer;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 4px;
  overflow: visible;
}
.jw-hamburger span {
  width: 13px; height: 2px;
  background: #1b1b1a;
  transform-origin: center;
  transition: transform .3s ease, opacity .3s ease;
}

.jw-mobile-overlay {
  display: none;
  position: fixed; inset: 0;
  z-index: 70;
  background: rgba(20,20,18,.4);
  transition: opacity .4s ease;
  opacity: 0;
  pointer-events: none;
}
.jw-mobile-overlay.open { opacity: 1; pointer-events: auto; }

.jw-mobile-panel {
  display: none;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  width: 100%;
  z-index: 71;
  background: #f1efe9;
  padding: 56px 32px 40px;
  box-shadow: 0 0 44px rgba(0,0,0,.16);
  transform: translateX(-100%);
  transition: transform .48s cubic-bezier(.22,.7,.24,1);
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}
.jw-mobile-panel.open { transform: translateX(0); }
.jw-mobile-name {
  font: 500 22px/1.05 'Newsreader', Georgia, serif;
  letter-spacing: -.01em;
  color: #1b1b1a;
  margin-bottom: 40px;
  position: absolute;
  top: 56px;
}
.jw-mobile-nav-item {
  cursor: pointer;
  margin-bottom: 20px;
  line-height: 1;
  text-align: center;
  opacity: 0;
  transform: translateX(-10px);
  transition: opacity .4s ease, transform .4s ease;
}
.jw-mobile-panel.open .jw-mobile-nav-item {
  opacity: 1;
  transform: none;
}
.jw-mobile-chat {
  cursor: pointer;
  margin-top: 16px;
  font: 600 22px/1.15 'Caveat', cursive;
  color: #84837e;
}

.jw-aside {
  width: 264px;
  flex: none;
  height: 100vh;
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  padding: 48px 32px 40px 48px;
}
.jw-name {
  font: 500 24px/1.2 'Newsreader', Georgia, serif;
  letter-spacing: -.01em;
  color: #1b1b1a;
}
.jw-nav { margin-top: 48px; }
.jw-nav-item {
  cursor: pointer;
  margin-bottom: 16px;
  line-height: 1;
  transition: transform .25s ease;
}
.jw-nav-item:hover { transform: translateX(4px); }
.jw-tag {
  display: inline-block;
  font: 600 21px/1.15 'Caveat', cursive;
  padding: 2px 10px 3px;
  border-radius: 7px 11px 8px 10px;
  transition: background-color .45s ease, color .45s ease, transform .45s cubic-bezier(.22,.7,.24,1);
}
.jw-spacer { flex: 1; }
.jw-chat-link {
  cursor: pointer;
  font: 600 21px/1 'Caveat', cursive;
  color: #9d9c97;
  transition: color .25s ease;
}
.jw-chat-link:hover { color: #1b1b1a; }

.jw-main {
  flex: 1;
  min-width: 0;
  padding: 48px 64px 96px 32px;
}
.jw-content { max-width: 860px; }

/* ---------- featured article ---------- */
.jw-featured {
  cursor: pointer;
  background: #fff;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 1px 2px rgba(0,0,0,.05), 0 10px 24px rgba(0,0,0,.045);
  margin-bottom: 26px;
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 1.1s cubic-bezier(.22,.7,.24,1), transform 1.1s cubic-bezier(.22,.7,.24,1), box-shadow .3s ease;
}
.jw-featured.shown { opacity: 1; transform: none; }
.jw-featured:hover {
  transform: translateY(-5px);
  box-shadow: 0 12px 26px rgba(0,0,0,.07), 0 30px 56px rgba(0,0,0,.08);
}
.jw-featured-hero { position: relative; height: 384px; background-size: cover; background-position: center; }
.jw-featured-body { padding: 32px 40px 40px; }
.jw-featured-body h2 {
  margin: 0 0 16px;
  font: 500 34px/1.18 'Newsreader', Georgia, serif;
  letter-spacing: -.012em;
  color: #161615;
  text-wrap: pretty;
}
.jw-featured-body p {
  margin: 0 0 20px;
  max-width: 640px;
  font: 400 16px/1.6 'Helvetica Neue', Arial, sans-serif;
  color: #54534f;
}

.jw-kicker { display: flex; gap: 4px; margin-bottom: 20px; }
.jw-kicker-letter {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #111;
  color: #fff;
  font: 800 13px/1 'Helvetica Neue', Arial, sans-serif;
  width: 22px; height: 22px;
}
.jw-kicker.small .jw-kicker-letter { width: 20px; height: 20px; font-size: 12px; }
.jw-kicker-substack { align-items: center; gap: 6px; }
.jw-kicker-substack svg { display: block; width: 100%; height: 100%; }
.jw-substack-word {
  font: 700 14px/1 'Helvetica Neue', Arial, sans-serif;
  letter-spacing: -.01em;
  color: #1a1a1a;
}
.jw-kicker-substack.small .jw-substack-word { font-size: 13px; }
.jw-date {
  font: 700 12px/1 'Helvetica Neue', Arial, sans-serif;
  letter-spacing: .06em;
  color: #a4a39e;
}

/* ---------- grid ---------- */
.jw-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0,1fr));
  grid-auto-rows: 212px;
  grid-auto-flow: dense;
  gap: 24px;
}
.jw-card {
  min-width: 0;
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 1.1s cubic-bezier(.22,.7,.24,1), transform 1.1s cubic-bezier(.22,.7,.24,1);
}
.jw-card.shown { opacity: 1; transform: none; }
.jw-card:hover .jw-card-inner { transform: translateY(-6px); }
.jw-card-inner { height: 100%; transition: transform .25s ease; }
.jw-card[data-span-lg] { grid-column: span 2; grid-row: span 2; }
.jw-card[data-span-md] { grid-column: span 1; grid-row: span 2; }
.jw-card[data-span-sm] { grid-column: span 1; grid-row: span 1; }

.jw-tile {
  height: 100%;
  box-sizing: border-box;
  border-radius: 16px;
  overflow: hidden;
  background: #fff;
  box-shadow: 0 1px 2px rgba(0,0,0,.01), 0 2px 4px rgba(0,0,0,.01);
  cursor: pointer;
  display: flex;
  flex-direction: column;
}
.jw-tile.jw-tile-note {
  cursor: default;
  padding: 28px;
  align-items: center;
  justify-content: center;
  background: #f6f4ee;
  background-image: radial-gradient(rgba(0,0,0,.028) 1px, transparent 1px);
  background-size: 6px 6px;
  box-shadow: 0 1px 2px rgba(0,0,0,.05), 0 8px 20px rgba(0,0,0,.04);
}
.jw-tile-note p {
  margin: 0;
  text-align: center;
  font: 600 26px/1.4 'Caveat', cursive;
  color: #26251f;
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.jw-note-location {
  margin-top: 12px;
  text-align: center;
  font: 700 11px/1.3 'Helvetica Neue', Arial, sans-serif;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: #a39d8f;
}
.jw-tile-book { }
.jw-tile-book .jw-tile-hero {
  position: relative;
  flex: 1;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.jw-tile-book .jw-tile-hero span {
  font: 700 48px/1 'Caveat', cursive;
  color: #fff;
  letter-spacing: .01em;
}
.jw-tile-foot { padding: 20px 24px; flex: none; }
.jw-tile-foot h3 {
  margin: 0 0 10px;
  font: 500 22px/1.3 'Newsreader', Georgia, serif;
  color: #161615;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.jw-tile-podcast {
  padding: 24px;
  align-items: center;
  justify-content: center;
  text-align: center;
}
.jw-tile-podcast .jw-podcast-label {
  font: 700 12px/1 'Helvetica Neue', Arial, sans-serif;
  letter-spacing: .1em;
  color: rgba(255,255,255,.6);
  margin-bottom: 12px;
}
.jw-tile-podcast h3 {
  margin: 0;
  color: #fff;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.jw-tile-sketch .jw-tile-hero,
.jw-tile-article .jw-tile-hero {
  position: relative;
  flex: 1;
  min-height: 0;
  background-size: cover;
  background-position: center;
}
.jw-tile-article .jw-tile-foot p {
  margin: 0 0 14px;
  color: #56554f;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.jw-tile-article .jw-tile-foot h3,
.jw-tile-sketch .jw-tile-foot h3 { text-wrap: pretty; }

.jw-tile-plain {
  padding: 24px;
}
.jw-tile-plain h3 {
  margin: 0;
  flex: 1;
  min-height: 0;
  color: #161615;
  text-wrap: pretty;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.jw-tile-plain .jw-date { margin-top: 10px; }

/* ---------- create page ---------- */
.jw-create-row { display: flex; gap: 40px; flex-wrap: wrap; align-items: flex-start; }
.jw-create-form { flex: 1; min-width: 300px; display: flex; flex-direction: column; gap: 20px; }
.jw-field { display: flex; flex-direction: column; gap: 8px; }
.jw-field-label {
  font: 700 12px/1 'Helvetica Neue', Arial, sans-serif;
  letter-spacing: .06em;
  color: #8a8a85;
}
.jw-field select,
.jw-field input[type="text"],
.jw-field textarea {
  padding: 12px 14px;
  border: 1px solid #ddd;
  border-radius: 10px;
  font: 400 15px/1 'Helvetica Neue', Arial, sans-serif;
  background: #fff;
  color: #161615;
}
.jw-field textarea { font: 400 15px/1.5 'Helvetica Neue', Arial, sans-serif; resize: vertical; }
.jw-size-row { display: flex; gap: 10px; margin-top: 8px; }
.jw-size-btn {
  flex: 1;
  padding: 10px;
  border-radius: 10px;
  border: 1px solid #ddd;
  cursor: pointer;
  font: 500 14px/1 'Helvetica Neue', Arial, sans-serif;
  background: #fff;
  color: #161615;
}
.jw-size-btn.active { background: #1b1b1a; color: #fff; }
.jw-checkbox-row { display: flex; align-items: center; gap: 10px; cursor: pointer; }
.jw-checkbox-row span { font: 400 14px/1 'Helvetica Neue', Arial, sans-serif; color: #56554f; }
.jw-category-checks { display: flex; flex-direction: column; gap: 10px; }
.jw-accent-row { display: flex; align-items: center; gap: 10px; }
.jw-publish-btn {
  align-self: flex-start;
  margin-top: 8px;
  padding: 14px 28px;
  border: none;
  border-radius: 100px;
  background: #1b1b1a;
  color: #fff;
  font: 500 15px/1 'Helvetica Neue', Arial, sans-serif;
  cursor: pointer;
}
.jw-published-note {
  padding: 16px 20px;
  border-radius: 10px;
  background: #eef6ef;
  color: #2f5d3f;
  font: 400 14px/1.5 'Helvetica Neue', Arial, sans-serif;
  animation: ovIn .4s ease both;
}
.jw-image-slot {
  width: 100%;
  height: 100%;
  border-radius: inherit;
  overflow: hidden;
  background: #eeece5;
  background-size: cover;
  background-position: center;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  position: relative;
  border: 1.5px dashed #c9c6bd;
  color: #9d9c97;
  font: 400 13px/1.3 'Helvetica Neue', Arial, sans-serif;
  text-align: center;
}
.jw-image-slot.filled { border: none; color: transparent; }
.jw-image-slot.circle { border-radius: 50%; }
.jw-image-slot input { display: none; }

.jw-preview-col { width: 320px; flex: none; }
.jw-preview-label {
  font: 700 12px/1 'Helvetica Neue', Arial, sans-serif;
  letter-spacing: .06em;
  color: #8a8a85;
  margin-bottom: 12px;
}
.jw-preview-frame {
  width: 100%;
  border-radius: 16px;
  overflow: hidden;
}

/* ---------- chat page ---------- */
.jw-chat { max-width: 640px; display: flex; flex-direction: column; align-items: flex-start; gap: 28px; }
.jw-chat-portrait { width: 160px; height: 160px; border-radius: 50%; overflow: hidden; flex: none; }
.jw-chat h2 { margin: 0; font: 500 34px/1.15 'Newsreader', Georgia, serif; color: #161615; }
.jw-chat p { margin: 0; font: 400 17px/1.65 'Helvetica Neue', Arial, sans-serif; color: #3f3e3a; text-wrap: pretty; }
.jw-chat-actions { display: flex; gap: 16px; flex-wrap: wrap; }
.jw-btn-dark, .jw-btn-outline {
  padding: 14px 28px;
  border-radius: 100px;
  text-decoration: none;
  font: 500 15px/1 'Helvetica Neue', Arial, sans-serif;
  display: inline-block;
}
.jw-btn-dark { background: #1b1b1a; color: #fff; }
.jw-btn-outline { border: 1px solid #1b1b1a; color: #1b1b1a; }

/* ---------- modal ---------- */
.jw-overlay {
  position: fixed; inset: 0;
  z-index: 50;
  background: rgba(228,227,223,.74);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 46px 24px;
  overflow: auto;
  overscroll-behavior: contain;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
  transition: opacity .85s ease;
  opacity: 1;
  animation: ovIn .45s ease both;
}
.jw-overlay.closing { opacity: 0; animation: none; }
.jw-modal-close-wrap {
  position: sticky;
  top: 0;
  align-self: stretch;
  height: 0;
  z-index: 60;
  pointer-events: none;
}
.jw-modal-close, .jw-modal-share {
  position: absolute;
  top: 34px;
  min-width: 40px; height: 40px;
  border: none;
  border-radius: 100px;
  background: rgba(255,255,255,.7);
  color: #2a2a28;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  pointer-events: auto;
  opacity: 0;
  animation: ovIn .5s ease .25s both;
  transition: background-color .2s ease;
}
.jw-modal-close:hover, .jw-modal-share:hover { background: rgba(255,255,255,.95); }
.jw-modal-close {
  right: 46px;
  font: 300 26px/1 'Helvetica Neue', Arial, sans-serif;
}
.jw-modal-share {
  right: 96px;
  padding: 0 12px;
  font: 500 13px/1 'Helvetica Neue', Arial, sans-serif;
}
.jw-modal-body-wrap {
  display: flex;
  flex-direction: column;
  gap: 28px;
  width: min(860px, 100%);
  transition: opacity .85s cubic-bezier(.4,0,.2,1), transform .85s cubic-bezier(.4,0,.2,1);
  opacity: 1;
  transform: none;
  animation: mdIn .6s cubic-bezier(.16,1,.3,1) both;
}
.jw-overlay.closing .jw-modal-body-wrap {
  opacity: 0;
  transform: translateY(36px) scale(.94);
  animation: none;
}
.jw-modal-card {
  background: #fff;
  border-radius: 18px;
  overflow: hidden;
  box-shadow: 0 30px 90px rgba(0,0,0,.24);
}
.jw-modal-hero { position: relative; height: 300px; background-size: cover; background-position: center; }
.jw-modal-content {
  padding: 40px 48px 48px;
  opacity: 0;
  animation: mdBodyIn .55s cubic-bezier(.22,.7,.24,1) .12s both;
}
.jw-modal-kicker-text {
  font: 700 12px/1 'Helvetica Neue', Arial, sans-serif;
  letter-spacing: .08em;
  color: #b4b3ae;
  margin-bottom: 16px;
}
.jw-modal-content h2 {
  margin: 0 0 24px;
  font: 500 32px/1.2 'Newsreader', Georgia, serif;
  letter-spacing: -.012em;
  color: #161615;
  text-wrap: pretty;
}
.jw-modal-content p {
  margin: 0 0 16px;
  font: 400 16px/1.65 'Helvetica Neue', Arial, sans-serif;
  color: #2c2b28;
}
.jw-modal-related {
  opacity: 0;
  animation: mdBodyIn .55s cubic-bezier(.22,.7,.24,1) .22s both;
}
.jw-related-title {
  font: 600 22px/1 'Caveat', cursive;
  color: #6f6f6a;
  margin-bottom: 16px;
  padding-left: 4px;
}
.jw-related-list { display: flex; gap: 20px; flex-wrap: wrap; }
.jw-related-item { width: 248px; height: 190px; flex: none; transition: transform .25s ease; }
.jw-related-item:hover { transform: translateY(-4px); }
.jw-related-item .jw-tile-book .jw-tile-hero span,
.jw-related-item .jw-tile-podcast h3 { font-size: 32px; }

/* ---------- manage page ---------- */
.jw-admin-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 24px;
  margin-bottom: 28px;
}
.jw-admin-list { display: flex; flex-direction: column; gap: 10px; }
.jw-admin-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 18px;
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 1px 2px rgba(0,0,0,.04), 0 1px 8px rgba(0,0,0,.03);
}
.jw-admin-row-main {
  display: flex;
  align-items: baseline;
  gap: 12px;
  min-width: 0;
}
.jw-admin-badge {
  flex: none;
  padding: 3px 8px;
  border-radius: 6px;
  background: #f1efe9;
  color: #6f6e69;
  font: 700 10px/1 'Helvetica Neue', Arial, sans-serif;
  letter-spacing: .06em;
  text-transform: uppercase;
}
.jw-admin-title {
  font: 500 15px/1.3 'Helvetica Neue', Arial, sans-serif;
  color: #161615;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.jw-admin-meta {
  flex: none;
  font: 400 12px/1 'Helvetica Neue', Arial, sans-serif;
  color: #a4a39e;
}
.jw-admin-row-actions { display: flex; gap: 8px; flex: none; }
.jw-admin-btn {
  padding: 8px 14px;
  border-radius: 8px;
  border: 1px solid #ddd;
  background: #fff;
  color: #161615;
  font: 500 13px/1 'Helvetica Neue', Arial, sans-serif;
  cursor: pointer;
}
.jw-admin-btn-danger { color: #8a2e26; border-color: #eecfcc; }
.jw-admin-btn:disabled { opacity: .5; cursor: default; }

/* ---------- responsive ---------- */
/* Kept at the end of the file on purpose: these override rules defined above
   (.jw-grid, .jw-card, .jw-create-row, .jw-preview-col, etc.), and with equal
   specificity the later rule in source order wins the cascade regardless of
   the media condition — so these must stay after everything they touch. */
@media (max-width: 860px) {
  .jw-aside { display: none !important; }
  .jw-hamburger { display: flex; }
  .jw-mobile-overlay { display: block; }
  .jw-mobile-panel { display: flex; }
  .jw-main { padding: 88px 20px 60px !important; }
  .jw-content { max-width: none !important; }
}

@media (max-width: 560px) {
  .jw-grid { grid-template-columns: 1fr; }
  .jw-card[data-span-lg], .jw-card[data-span-md] { grid-column: span 1; }
  .jw-create-row { flex-direction: column; }
  .jw-preview-col { width: 100%; }
}
