/* =========================================================
   Blog (public) + Admin panel styles.
   Built on the design tokens already defined in style.css
   (--ink, --gold, --paper, Fraunces/Public Sans/IBM Plex Mono).
   Load style.css BEFORE this file.
   ========================================================= */

/* ---------- shared: nav active state for the Blog link ---------- */
nav.links a.active{ color: var(--gold-bright); }
nav.links a.active::after{ transform: scaleX(1); }

/* ---------- BLOG: hero ---------- */
/* Same radial-gradient palette as the homepage hero mesh, as a static
   (non-animated) backdrop — on-brand without the extra motion weight. */
.blog-hero{
  padding: 88px 0 56px; border-bottom: 1px solid var(--rule); position: relative; overflow: hidden;
  background:
    radial-gradient(38% 55% at 15% 20%, rgba(214,164,79,.16), transparent 70%),
    radial-gradient(32% 45% at 85% 10%, rgba(156,78,52,.13), transparent 72%),
    var(--grad-emerald);
}
.blog-hero .wrap{ position: relative; z-index: 1; }
.blog-hero h1{ font-size: clamp(2rem, 4vw, 2.8rem); max-width: 16ch; }
.blog-hero p{ color: var(--muted); font-size: 17px; max-width: 56ch; margin: 0; }

/* ---------- BLOG: post grid ---------- */
.post-grid{
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 26px;
  padding: 56px 0 20px;
}
@media (max-width: 980px){ .post-grid{ grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 640px){ .post-grid{ grid-template-columns: 1fr; } }

.post-card{
  display: flex; flex-direction: column;
  background: linear-gradient(160deg, var(--ink-3), var(--ink-2)); border: 1px solid var(--rule); border-radius: 8px;
  overflow: hidden; text-decoration: none; color: inherit;
  transition: transform .35s var(--ease-premium), border-color .3s ease, box-shadow .35s ease;
}
.post-card:hover{ transform: translateY(-6px); border-color: var(--gold-bright); box-shadow: var(--shadow-lift); }
.post-card-img{
  aspect-ratio: 16/10; background: linear-gradient(150deg, var(--ink-3), var(--ink-2));
  background-size: cover; background-position: center;
}
.post-card-body{ padding: 20px 22px 24px; display: flex; flex-direction: column; gap: 10px; flex: 1; }
.post-card-cat{
  font-family: 'IBM Plex Mono', monospace; font-size: 10.5px; letter-spacing: .08em; text-transform: uppercase;
  color: var(--gold-bright);
}
.post-card-title{
  font-size: 19px; margin: 0; line-height: 1.3;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.post-card-excerpt{
  color: var(--muted); font-size: 14px; line-height: 1.6; margin: 0; flex: 1;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.post-card-meta{
  display: flex; align-items: center; gap: 9px; flex-wrap: wrap;
  font-family: 'IBM Plex Mono', monospace; font-size: 11px; color: var(--muted); letter-spacing: .03em;
  padding-top: 10px; border-top: 1px solid var(--rule);
}
.meta-dot{ width: 3px; height: 3px; border-radius: 50%; background: var(--gold-bright); display: inline-block; flex-shrink: 0; }

.post-card-more{
  display: inline-flex; align-items: center; gap: 7px; margin-top: 4px;
  font-family: 'IBM Plex Mono', monospace; font-size: 11.5px; letter-spacing: .06em; text-transform: uppercase;
  color: var(--gold-bright);
}
.post-card-more svg{ width: 14px; height: 14px; transition: transform .25s var(--ease-premium); }
.post-card:hover .post-card-more svg,
.post-feature:hover .post-card-more svg{ transform: translateX(5px); }
.post-card:focus-visible, .post-feature:focus-visible, .related-card:focus-visible{
  outline: 2px solid var(--gold-bright); outline-offset: 3px;
}

/* ---------- BLOG: featured (latest) article ---------- */
.post-feature{
  display: grid; grid-template-columns: 1.15fr 1fr; align-items: stretch;
  background: linear-gradient(160deg, var(--ink-3), var(--ink-2)); border: 1px solid var(--rule); border-radius: 10px;
  overflow: hidden; text-decoration: none; color: inherit; margin: 56px 0 8px;
  transition: transform .35s var(--ease-premium), border-color .3s ease, box-shadow .35s ease;
}
.post-feature:hover{ transform: translateY(-5px); border-color: var(--gold-bright); box-shadow: var(--shadow-lift); }
.post-feature-img{
  min-height: 340px; background: linear-gradient(150deg, var(--ink-3), var(--ink-2));
  background-size: cover; background-position: center; position: relative;
}
.post-chip{
  position: absolute; top: 16px; left: 16px; padding: 5px 12px; border-radius: 14px;
  background: var(--gold-bright); color: #1A1408;
  font-family: 'IBM Plex Mono', monospace; font-size: 10px; font-weight: 700;
  letter-spacing: .1em; text-transform: uppercase;
}
.post-feature-body{ padding: 34px 36px 30px; display: flex; flex-direction: column; gap: 14px; }
.post-feature-title{ font-size: clamp(1.4rem, 2.4vw, 1.9rem); line-height: 1.22; margin: 0; }
.post-feature-excerpt{
  color: var(--muted); font-size: 15px; line-height: 1.65; margin: 0; flex: 1;
  display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden;
}
@media (max-width: 860px){
  .post-feature{ grid-template-columns: 1fr; }
  .post-feature-img{ min-height: 0; aspect-ratio: 16/9; }
  .post-feature-body{ padding: 24px 22px 24px; }
}

.empty-state{ padding: 40px 0 80px; color: var(--muted); }

.pagination{ display: flex; gap: 10px; justify-content: center; padding: 20px 0 80px; }
.pagination a, .pagination span{
  font-family: 'IBM Plex Mono', monospace; font-size: 13px; padding: 8px 14px; border: 1px solid var(--rule-strong);
  border-radius: 4px; color: var(--muted); text-decoration: none;
}
.pagination a:hover{ border-color: var(--gold-bright); color: var(--gold-bright); }
.pagination .current{ background: var(--gold-bright); color: #1A1408; border-color: var(--gold-bright); }

/* ---------- BLOG: single post ---------- */
.post-article{ padding: 64px 0 90px; }
.post-article-head{ max-width: 74ch; margin: 0 auto 32px; text-align: center; }
.post-article-head .post-card-cat{ justify-content: center; display: block; margin-bottom: 12px; }
.post-article-head h1{ font-size: clamp(1.9rem, 4vw, 2.6rem); line-height: 1.2; }
.post-meta-row{
  display: flex; align-items: center; justify-content: center; gap: 10px; flex-wrap: wrap;
  font-family: 'IBM Plex Mono', monospace; font-size: 12px; color: var(--muted); letter-spacing: .04em;
  margin-top: 18px;
}
.post-standfirst{
  max-width: 74ch; margin: 0 auto 40px; padding: 4px 0 4px 22px; border-left: 3px solid var(--gold-bright);
  font-family: 'Fraunces', serif; font-size: 19px; line-height: 1.6; color: var(--text-light); font-style: italic;
}
.post-cover{
  max-width: 680px; margin: 0 auto 40px; border-radius: 8px; overflow: hidden; border: 1px solid var(--rule);
  box-shadow: var(--shadow-lift);
}
.post-cover img{ width: 100%; display: block; aspect-ratio: 16/9; object-fit: cover; }

.post-content{ max-width: 74ch; margin: 0 auto; font-size: 17px; line-height: 1.75; color: var(--text-light); }
.post-content h1, .post-content h2, .post-content h3{ margin-top: 1.6em; }
.post-content p{ margin: 0 0 1.3em; }
.post-content a{ color: var(--gold-bright); text-decoration: underline; text-underline-offset: 3px; }
.post-content img{ border-radius: 6px; margin: 1.6em 0; }
.post-content blockquote{
  margin: 1.6em 0; padding: 4px 0 4px 22px; border-left: 3px solid var(--gold-bright);
  font-style: italic; color: var(--muted);
}
.post-content code{
  font-family: 'IBM Plex Mono', monospace; font-size: .88em; background: var(--ink-3);
  padding: .15em .4em; border-radius: 3px;
}
.post-content pre{ background: var(--ink-3); padding: 18px 20px; border-radius: 6px; overflow-x: auto; }
.post-content pre code{ background: none; padding: 0; }
.post-content ul, .post-content ol{ margin: 0 0 1.3em; padding-left: 1.4em; }
.post-content li{ margin-bottom: .4em; }
.post-content hr{ border: none; border-top: 1px solid var(--rule); margin: 2.4em 0; }

/* ---------- BLOG: author card ---------- */
.post-author-card{
  max-width: 74ch; margin: 60px auto 0; display: flex; align-items: center; gap: 18px; flex-wrap: wrap;
  background: linear-gradient(160deg, var(--ink-3), var(--ink-2)); border: 1px solid var(--rule); border-radius: 10px;
  padding: 22px 26px;
}
.post-author-seal{
  width: 52px; height: 52px; border-radius: 50%; flex-shrink: 0;
  border: 1px solid var(--rule-strong); background: var(--ink-3); object-fit: cover;
}
.post-author-info{ display: flex; flex-direction: column; gap: 3px; flex: 1; min-width: 180px; }
.post-author-label{
  font-family: 'IBM Plex Mono', monospace; font-size: 10px; letter-spacing: .12em; text-transform: uppercase;
  color: var(--muted);
}
.post-author-info strong{ font-family: 'Fraunces', serif; font-size: 17px; }
.post-author-role{
  font-family: 'IBM Plex Mono', monospace; font-size: 10.5px; letter-spacing: .08em; text-transform: uppercase;
  color: var(--gold-bright);
}
.post-author-link{
  font-family: 'IBM Plex Mono', monospace; font-size: 12px; letter-spacing: .04em;
  color: var(--muted); text-decoration: none; transition: color .2s ease;
}
.post-author-link:hover{ color: var(--gold-bright); }

/* ---------- BLOG: related articles ---------- */
.related-posts{ max-width: 980px; margin: 70px auto 0; border-top: 1px solid var(--rule); padding-top: 40px; }
.related-posts h2{ font-size: 1.2rem; margin-bottom: 22px; }
.related-grid{ display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
@media (max-width: 860px){ .related-grid{ grid-template-columns: 1fr; } }
.related-card{
  display: flex; flex-direction: column;
  background: linear-gradient(160deg, var(--ink-3), var(--ink-2)); border: 1px solid var(--rule); border-radius: 8px;
  overflow: hidden; text-decoration: none; color: inherit;
  transition: transform .3s var(--ease-premium), border-color .25s ease;
}
.related-card:hover{ transform: translateY(-4px); border-color: var(--gold-bright); }
.related-card-img{
  aspect-ratio: 16/9; background: linear-gradient(150deg, var(--ink-3), var(--ink-2));
  background-size: cover; background-position: center;
}
.related-card-body{ padding: 16px 18px 18px; display: flex; flex-direction: column; gap: 8px; }
.related-card-body h3{
  font-size: 15.5px; line-height: 1.35; margin: 0;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.related-card-date{
  font-family: 'IBM Plex Mono', monospace; font-size: 10.5px; color: var(--muted); letter-spacing: .04em;
}
.back-link{
  display: inline-block; margin-bottom: 30px; font-family: 'IBM Plex Mono', monospace; font-size: 12.5px;
  color: var(--muted); text-decoration: none; letter-spacing: .04em;
}
.back-link:hover{ color: var(--gold-bright); }

/* ---------- ADMIN: shell + sidebar ---------- */
.admin-shell{ min-height: 100vh; background: var(--ink); color: var(--text-light); display: flex; align-items: stretch; }

.admin-sidebar{
  width: 262px; flex: 0 0 262px; position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column;
  background: linear-gradient(180deg, var(--ink-2), var(--ink) 85%);
  border-right: 1px solid var(--rule);
  padding: 22px 16px 18px;
  overflow-y: auto;
}

.admin-brand{ display: flex; align-items: center; gap: 12px; text-decoration: none; color: var(--text-light); padding: 0 8px; }
.admin-seal{
  width: 38px; height: 38px; flex-shrink: 0; border-radius: 50%;
  border: 1px solid var(--rule-strong); background: var(--ink-3); object-fit: cover;
}
.admin-brand-name{ font-family: 'Fraunces', serif; font-weight: 600; font-size: 14.5px; line-height: 1.25; }
.admin-brand-name span{
  display: block; font-family: 'IBM Plex Mono', monospace; font-size: 9.5px; letter-spacing: .14em;
  text-transform: uppercase; color: var(--gold-bright); margin-top: 3px;
}

.admin-nav{ display: flex; flex-direction: column; gap: 2px; margin-top: 24px; flex: 1; }
.admin-nav-label{
  font-family: 'IBM Plex Mono', monospace; font-size: 10px; letter-spacing: .12em; text-transform: uppercase;
  color: var(--muted); opacity: .75; padding: 0 12px; margin: 18px 0 6px;
}
.admin-nav-label:first-child{ margin-top: 0; }
.admin-nav-link{
  display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 6px;
  color: var(--muted); text-decoration: none; font-size: 14px; font-weight: 500;
  border: 1px solid transparent;
  transition: background .18s ease, color .18s ease, border-color .18s ease;
}
.admin-nav-link svg{ width: 17px; height: 17px; flex-shrink: 0; opacity: .85; }
.admin-nav-link:hover{ background: rgba(255,255,255,.045); color: var(--text-light); }
.admin-nav-link.active{
  background: rgba(214,164,79,.10); color: var(--gold-bright);
  border-color: rgba(214,164,79,.24);
}
.admin-nav-link .ext{ margin-left: auto; width: 13px; height: 13px; opacity: .55; }
.nav-badge{
  margin-left: auto; min-width: 20px; padding: 2px 7px; border-radius: 10px; background: var(--gold-bright);
  color: #1A1408; font-family: 'IBM Plex Mono', monospace; font-size: 10.5px; font-weight: 700;
  text-align: center; line-height: 1.5;
}

.admin-sidebar-foot{
  border-top: 1px solid var(--rule); margin-top: 16px; padding-top: 14px;
  display: flex; flex-direction: column; gap: 12px;
}
.admin-user{ display: flex; align-items: center; gap: 11px; padding: 0 8px; }
.admin-user-avatar{
  width: 34px; height: 34px; flex-shrink: 0; border-radius: 50%;
  display: grid; place-items: center;
  font-family: 'Fraunces', serif; font-weight: 600; font-size: 15px;
  background: linear-gradient(140deg, var(--gold-bright), #A97B2F); color: #1A1408;
}
.admin-user-meta{ display: flex; flex-direction: column; line-height: 1.35; min-width: 0; }
.admin-user-meta em{
  font-style: normal; font-family: 'IBM Plex Mono', monospace; font-size: 9.5px;
  letter-spacing: .1em; text-transform: uppercase; color: var(--muted);
}
.admin-user-meta strong{ font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.admin-logout{
  display: flex; align-items: center; justify-content: center; gap: 9px; width: 100%;
  background: none; border: 1px solid var(--rule-strong); border-radius: 6px;
  color: var(--muted); font-family: 'Public Sans', sans-serif; font-size: 13px; font-weight: 500;
  padding: 9px 12px; cursor: pointer;
  transition: color .18s ease, border-color .18s ease, background .18s ease;
}
.admin-logout svg{ width: 15px; height: 15px; }
.admin-logout:hover{ color: #E39A82; border-color: rgba(156,78,52,.6); background: rgba(156,78,52,.08); }

.admin-main{ flex: 1; min-width: 0; max-width: 1080px; padding: 44px 40px 90px; }
.admin-main h1{ font-size: 1.7rem; margin-bottom: 6px; }
.admin-sub{ color: var(--muted); font-size: 14.5px; margin-bottom: 30px; }

/* ---------- ADMIN: mobile drawer ---------- */
.admin-mobilebar{ display: none; }
.admin-scrim{ display: none; }
.admin-menu-toggle{
  display: none; background: none; border: 1px solid var(--rule-strong); border-radius: 6px;
  color: var(--text-light); width: 40px; height: 38px; place-items: center; cursor: pointer;
}
@media (max-width: 900px){
  .admin-shell{ display: block; }
  .admin-mobilebar{
    display: flex; align-items: center; justify-content: space-between; gap: 16px;
    position: sticky; top: 0; z-index: 60;
    background: var(--ink-2); border-bottom: 1px solid var(--rule); padding: 12px 18px;
  }
  .admin-mobilebar .admin-brand{ padding: 0; }
  .admin-mobilebar .admin-brand-name{ font-size: 13.5px; }
  .admin-menu-toggle{ display: grid; }
  .admin-sidebar{
    position: fixed; top: 0; left: 0; bottom: 0; z-index: 70; height: 100vh; width: min(290px, 84vw);
    transform: translateX(-102%); transition: transform .28s ease;
    box-shadow: 0 0 60px rgba(0,0,0,.55);
  }
  body.admin-menu-open .admin-sidebar{ transform: none; }
  .admin-scrim{ display: block; position: fixed; inset: 0; z-index: 65; background: rgba(8,10,9,.6); }
  .admin-scrim[hidden]{ display: none; }
  .admin-main{ padding: 28px 18px 70px; }
}

.flash-message{
  background: rgba(214,164,79,.12); border: 1px solid rgba(214,164,79,.4); color: var(--gold-bright);
  padding: 12px 18px; border-radius: 4px; font-size: 14px; margin-bottom: 26px;
}
.error-message{
  background: rgba(156,78,52,.15); border: 1px solid rgba(156,78,52,.5); color: #E39A82;
  padding: 12px 18px; border-radius: 4px; font-size: 14px; margin-bottom: 22px;
}
.success-message{
  background: rgba(120,160,120,.15); border: 1px solid rgba(120,160,120,.5); color: #9FCF9F;
  padding: 12px 18px; border-radius: 4px; font-size: 14px; margin-bottom: 22px;
}

/* ---------- ADMIN: dashboard table ---------- */
.admin-toolbar{ display: flex; justify-content: space-between; align-items: center; margin-bottom: 24px; gap: 16px; flex-wrap: wrap; }
.admin-table{ width: 100%; border-collapse: collapse; font-size: 14.5px; }
.admin-table th{
  text-align: left; font-family: 'IBM Plex Mono', monospace; font-size: 11px; letter-spacing: .06em; text-transform: uppercase;
  color: var(--muted); padding: 10px 14px; border-bottom: 1px solid var(--rule-strong);
}
.admin-table td{ padding: 14px; border-bottom: 1px solid var(--rule); vertical-align: middle; }
.admin-table tr:hover td{ background: rgba(255,255,255,.02); }
.post-title-cell{ font-weight: 600; }
.post-title-cell a{ color: var(--text-light); text-decoration: none; }
.post-title-cell a:hover{ color: var(--gold-bright); }

.status-pill{
  display: inline-block; font-family: 'IBM Plex Mono', monospace; font-size: 10.5px; letter-spacing: .06em;
  text-transform: uppercase; padding: 4px 10px; border-radius: 12px; border: 1px solid var(--rule-strong);
}
.status-pill.published{ color: #9FCF9F; border-color: rgba(159,207,159,.5); }
.status-pill.draft{ color: var(--muted); }

.row-actions{ display: flex; gap: 14px; align-items: center; white-space: nowrap; }
.row-actions a, .row-actions button{
  font-family: 'IBM Plex Mono', monospace; font-size: 12px; background: none; border: none; cursor: pointer;
  color: var(--muted); text-decoration: none; padding: 0;
}
.row-actions a:hover, .row-actions button:hover{ color: var(--gold-bright); }
.row-actions button.danger:hover{ color: #E39A82; }

.empty-admin{ padding: 60px 0; text-align: center; color: var(--muted); }

/* ---------- ADMIN: forms ---------- */
.field{ margin-bottom: 22px; }
.field label{
  display: block; font-family: 'IBM Plex Mono', monospace; font-size: 11.5px; letter-spacing: .05em; text-transform: uppercase;
  color: var(--muted); margin-bottom: 8px;
}
.field .hint{ color: var(--muted); font-size: 12px; margin-top: 6px; }
.field input[type="text"], .field input[type="password"], .field input[type="file"],
.field textarea, .field select{
  width: 100%; background: var(--ink-2); border: 1px solid var(--rule-strong); color: var(--text-light);
  padding: 11px 14px; border-radius: 4px; font-family: 'Public Sans', sans-serif; font-size: 14.5px;
}
.field textarea{ resize: vertical; min-height: 120px; }
.field input:focus, .field textarea:focus, .field select:focus{
  outline: none; border-color: var(--gold-bright); box-shadow: 0 0 0 3px rgba(214,164,79,.15);
}
.field-row{ display: flex; gap: 20px; flex-wrap: wrap; }
.field-row > .field{ flex: 1; min-width: 200px; }
.checkbox-field{ display: flex; align-items: center; gap: 10px; font-size: 14px; color: var(--muted); }
.checkbox-field input{ width: auto; }

.editor-grid{ display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
@media (max-width: 900px){ .editor-grid{ grid-template-columns: 1fr; } }
.editor-pane textarea{ min-height: 420px; font-family: 'IBM Plex Mono', monospace; font-size: 13.5px; line-height: 1.6; }
.preview-pane{
  background: var(--ink-2); border: 1px solid var(--rule); border-radius: 4px; padding: 20px 24px;
  max-height: 460px; overflow-y: auto;
}
.preview-pane .post-content{ font-size: 15px; max-width: none; }
.pane-label{
  font-family: 'IBM Plex Mono', monospace; font-size: 11px; letter-spacing: .06em; text-transform: uppercase;
  color: var(--muted); margin-bottom: 8px; display: block;
}

.cover-preview{ margin-bottom: 12px; max-width: 240px; border-radius: 4px; overflow: hidden; border: 1px solid var(--rule); }
.cover-preview img{ width: 100%; display: block; }

.form-actions{ display: flex; gap: 14px; margin-top: 32px; align-items: center; }
.btn-danger{ background: transparent; border: 1px solid rgba(156,78,52,.6); color: #E39A82; }
.btn-danger:hover{ background: rgba(156,78,52,.15); border-color: #E39A82; }

/* ---------- ADMIN: login ---------- */
.login-shell{
  min-height: 100vh; display: flex; align-items: center; justify-content: center; background: var(--ink); padding: 24px;
}
.login-card{
  width: 100%; max-width: 380px; background: var(--ink-2); border: 1px solid var(--rule); border-radius: 8px; padding: 40px 36px;
}
.login-card .brand-mark{ width: 44px; height: 44px; margin-bottom: 18px; }
.login-card h1{ font-size: 1.4rem; margin-bottom: 6px; }
.login-card p.sub{ color: var(--muted); font-size: 14px; margin-bottom: 26px; }
.login-card .btn{ width: 100%; text-align: center; margin-top: 6px; }
