@import url("https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600;700&family=Source+Serif+4:opsz,wght@8..60,400;8..60,600;8..60,700&display=swap");

.post-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, 235px);
  gap: 12px;
  justify-content: center;
  padding: 30px;
}

.post-card {
  min-width: 0;
  overflow: hidden;
  border-radius: 8px;
  background: var(--background-secondary);
  box-shadow: 0 0 10px rgba(0, 0, 0, .2);
  transition: transform .1s, box-shadow .1s;
}

.post-card:hover {
  z-index: 2;
  transform: scale(1.035);
  box-shadow: 0 0 10px rgba(0, 0, 0, .5);
}

.post-card > a {
  display: flex;
  height: 100%;
  flex-direction: column;
  color: var(--text-main);
  text-decoration: none;
}

.post-cover {
  position: relative;
  height: 175px;
  overflow: hidden;
  border-radius: 8px 8px 0 0;
  background: var(--code-background);
}

.post-cover img {
  width: 100%;
  height: 100%;
  padding: 8px;
  background: #f5f5f5;
  object-fit: contain;
}

.generated-cover {
  background:
    radial-gradient(circle at 25% 68%, rgba(255, 199, 102, .9) 0 4px, transparent 5px),
    linear-gradient(90deg, transparent 49%, rgba(68, 147, 184, .55) 50%, transparent 51%),
    linear-gradient(0deg, transparent 49%, rgba(68, 147, 184, .35) 50%, transparent 51%),
    linear-gradient(140deg, #0d1e38, #274a67);
  background-size: auto, 32px 32px, 32px 32px, auto;
}

.status-badge,
.draft-banner {
  display: inline-flex;
  padding: 4px 9px;
  border-radius: 20px;
  background: var(--yellow);
  color: #111;
  font-size: 11px;
  font-weight: 700;
}

.status-badge {
  position: absolute;
  top: 8px;
  right: 8px;
}

.post-card-body {
  display: grid;
  gap: 3px;
  padding: 9px 10px 12px;
}

.post-card-body h3 {
  margin: 0;
  overflow-wrap: anywhere;
  font-size: 16px;
  line-height: 1.25;
}

.post-card-body p,
.post-card-body span {
  margin: 0;
  color: var(--text-secondary);
  font-size: 12px;
}

.empty-state {
  margin: 30px;
  padding: 45px 20px;
  border: 2px solid var(--code-border);
  border-radius: 10px;
  background: var(--background-secondary);
  text-align: center;
}

.empty-state h2 {
  margin: 0 0 8px;
}

.empty-state p {
  margin: 0 0 20px;
  color: var(--text-secondary);
}

.page-shell {
  min-height: 100vh;
  padding: 100px 20px 80px;
}

.reading-view {
  width: min(900px, 100%);
  margin: 0 auto;
  padding: 30px;
  border-radius: 5px;
  background: var(--background-secondary);
  box-shadow: var(--card-shadow);
}

.article-header h1 {
  margin: 0 0 10px;
  color: var(--header-color);
  font-size: clamp(42px, 6vw, 60px);
  font-weight: 700;
  line-height: 1.14;
  overflow-wrap: anywhere;
}

.article-summary {
  max-width: 760px;
  margin: 0 0 18px;
  color: var(--header-secondary);
  font-size: 17px;
  line-height: 1.6;
}

.draft-banner {
  margin: 0 0 12px;
}

.article-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding-bottom: 6px;
  border-bottom: 2px solid var(--code-border);
  color: var(--header-secondary);
  font-size: 16px;
  font-weight: 300;
}

.blog-content {
  padding: 36px 0 28px;
  color: var(--text-main);
  font-size: 16px;
  line-height: 1.7;
  overflow-wrap: anywhere;
}

.blog-content p {
  margin: 0 0 1.35em;
}

.blog-content h2,
.blog-content h3,
.blog-content h4 {
  margin: 1.8em 0 .55em;
  color: var(--text-main);
  font-weight: 700;
  line-height: 1.4;
  scroll-margin-top: 25px;
}

.blog-content h2 {
  font-size: 23px;
}

.blog-content h3 {
  font-size: 20px;
}

.blog-content h4 {
  font-size: 18px;
}

.blog-content a {
  color: var(--header-color);
  text-underline-offset: 2px;
}

.blog-content ul,
.blog-content ol {
  margin: 0 0 1.4em;
  padding-left: 35px;
}

.blog-content li {
  margin: .5em 0;
}

.blog-content blockquote {
  margin: 1.8em 0;
  padding: 12px 16px;
  border-left: 4px solid var(--yellow);
  border-radius: 0 8px 8px 0;
  background: var(--code-background);
}

.blog-content code {
  padding: 2px 5px;
  border-radius: 4px;
  background: var(--code-background);
  font-family: monospace;
  font-size: .9em;
}

.blog-content pre {
  max-width: 100%;
  margin: 1.8em 0;
  padding: 16px;
  overflow: auto;
  border: 2px solid var(--code-border);
  border-radius: 10px;
  background: var(--code-background);
}

.blog-content pre code {
  padding: 0;
  background: transparent;
}

.blog-content figure {
  width: min(100%, 820px);
  margin: 2.3em auto;
  text-align: center;
}

.blog-content figure img,
.blog-content > img {
  display: block;
  width: auto;
  max-width: 100%;
  max-height: 75vh;
  margin: 0 auto;
  border-radius: 5px;
  background: #fff;
  object-fit: contain;
}

.blog-content figcaption {
  margin-top: 8px;
  color: var(--text-secondary);
  font-size: 12px;
}

.blog-content table {
  display: block;
  width: 100%;
  margin: 1.8em 0;
  overflow-x: auto;
  border-collapse: collapse;
  font-size: 14px;
}

.blog-content th,
.blog-content td {
  padding: 9px 10px;
  border: 1px solid var(--code-border);
  text-align: left;
}

.blog-content th {
  background: var(--code-background);
}

.blog-content .formula {
  margin: 1.7em 0;
  font-size: 18px;
  text-align: center;
}

.blog-content .refSpan {
  margin-left: 2px;
  padding: 0 3px;
  border-radius: 3px;
  background: #d0e8f7;
  color: #1aa7ff;
  font-size: 10px;
  font-weight: 700;
  vertical-align: super;
  text-decoration: none;
}

.blog-content .references {
  margin-top: 3em;
  padding-top: 5px;
  border-top: 2px solid var(--code-border);
}

.blog-content .references li {
  margin-bottom: 1em;
  color: var(--text-secondary);
  font-size: 13px;
}

.blog-content .model-output {
  padding: 1px 3px;
  background: rgba(255, 183, 0, .16);
  color: var(--particle-accent);
}

.post-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
  padding-top: 20px;
  border-top: 2px solid var(--code-border);
}

.discussion {
  margin-top: 15px;
  padding: 26px 0;
  border-top: 2px solid var(--code-border);
}

.discussion-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 20px;
}

.discussion-heading h2 {
  margin: 0;
  font-size: 23px;
}

.discussion-heading p,
.no-comments {
  margin: 3px 0 0;
  color: var(--text-secondary);
  font-size: 12px;
}

.discussion-heading form {
  margin: 0;
}

.like-button,
.comment-form button {
  display: inline-flex;
  min-height: 38px;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 6px 15px;
  border: 0;
  border-radius: 20px;
  background: var(--yellow);
  color: #111;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

.like-button:hover,
.comment-form button:hover {
  background: var(--yellow-hover);
  color: var(--text-main);
}

.like-button span {
  min-width: 22px;
  padding: 1px 6px;
  border-radius: 12px;
  background: rgba(0, 0, 0, .15);
  font-size: 12px;
}

.comment-list {
  display: grid;
  gap: 9px;
  margin-bottom: 20px;
}

.comment {
  padding: 13px 15px;
  border: 2px solid var(--code-border);
  border-radius: 9px;
  background: var(--code-background);
}

.comment header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.comment header > div {
  display: flex;
  align-items: baseline;
  gap: 9px;
}

.comment header span {
  color: var(--text-secondary);
  font-size: 10px;
}

.comment header form {
  margin: 0;
}

.comment header button {
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--header-secondary);
  font: inherit;
  font-size: 11px;
  cursor: pointer;
}

.comment > p {
  margin: 8px 0 0;
  white-space: pre-wrap;
}

.comment-form {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 7px 12px;
  margin-top: 20px;
  padding-top: 20px;
  border-top: 2px solid var(--code-border);
}

.comment-form label {
  color: var(--text-main);
  font-size: 12px;
  font-weight: 700;
}

.comment-form label span {
  color: var(--text-secondary);
  font-weight: 400;
}

.comment-form input,
.comment-form textarea {
  grid-column: 1 / -1;
  width: 100%;
  padding: 10px 12px;
  border: 2px solid var(--code-border);
  border-radius: 8px;
  outline: 0;
  background: var(--code-background);
  color: var(--text-main);
  font: inherit;
}

.comment-form textarea {
  min-height: 110px;
  resize: vertical;
}

.comment-form input:focus,
.comment-form textarea:focus {
  border-color: var(--header-color);
}

.comment-form button {
  grid-column: 2;
  margin-top: 5px;
}

.post-actions > div {
  display: flex;
  gap: 8px;
}

.post-actions form {
  display: inline-flex;
  margin: 0;
}

.secondary-button,
.editor button,
.danger-button {
  display: inline-flex;
  min-height: 38px;
  align-items: center;
  justify-content: center;
  padding: 6px 15px;
  border: 0;
  border-radius: 20px;
  background: var(--yellow);
  color: #111;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
}

.secondary-button:hover,
.editor button:hover {
  background: var(--yellow-hover);
  color: var(--text-main);
}

.danger-button {
  background: #81353c;
  color: #fff;
}

.editor-heading {
  display: flex;
  width: min(900px, 100%);
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin: 0 auto 25px;
  padding: 100px 0 0;
}

.editor-heading .eyebrow {
  margin: 0 0 4px;
  color: var(--header-secondary);
  font-size: 12px;
  text-transform: uppercase;
}

.editor-heading h1 {
  margin: 0;
  color: var(--header-color);
  font-size: clamp(34px, 5vw, 48px);
}

.editor {
  display: grid;
  width: min(900px, calc(100% - 40px));
  gap: 11px;
  margin: 0 auto 80px;
  padding: 30px;
  border-radius: 5px;
  background: var(--background-secondary);
  box-shadow: var(--card-shadow);
}

.editor > label:not(.publish-control),
.format-picker legend {
  margin-top: 8px;
  color: var(--text-main);
  font-size: 12px;
  font-weight: 700;
}

.editor label span {
  color: var(--text-secondary);
  font-weight: 400;
}

.editor > input:not([type]),
.editor input[type="text"],
.editor textarea,
.editor .file-input {
  width: 100%;
  padding: 12px;
  border: 2px solid var(--code-border);
  border-radius: 8px;
  outline: 0;
  background: var(--code-background);
  color: var(--text-main);
}

.editor > input:not([type]):focus,
.editor textarea:focus {
  border-color: var(--header-color);
}

.editor input#title {
  font-size: 22px;
  font-weight: 600;
}

.summary-input {
  min-height: 90px;
}

.body-input {
  min-height: 52vh;
  resize: vertical;
  font-family: monospace;
  line-height: 1.6;
}

.format-picker {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: 8px 0 0;
  padding: 0;
  border: 0;
}

.format-picker legend {
  grid-column: 1 / -1;
}

.format-picker label,
.publish-control {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 14px;
  border: 2px solid var(--code-border);
  border-radius: 8px;
  background: var(--code-background);
  cursor: pointer;
}

.format-picker label:has(input:checked),
.publish-control:has(input:checked) {
  border-color: var(--yellow);
}

.format-picker input,
.publish-control input {
  margin-top: 4px;
  accent-color: var(--yellow);
}

.format-picker span,
.publish-control span {
  display: grid;
  gap: 3px;
}

.format-picker small,
.publish-control small,
.field-help,
.editor-actions > span {
  color: var(--text-secondary);
  font-size: 12px;
}

.editor-help {
  padding: 10px 12px;
  border-radius: 8px;
  background: var(--code-background);
  color: var(--text-secondary);
  font-size: 12px;
}

.editor-help code {
  margin-right: 10px;
}

.editor-help[hidden] {
  display: none;
}

.editor-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-top: 10px;
}

.flash-stack {
  position: fixed;
  z-index: 200;
  top: 75px;
  right: 20px;
}

.flash {
  padding: 10px 14px;
  border: 2px solid var(--code-border);
  border-radius: 8px;
  background: var(--background-secondary);
  box-shadow: var(--card-shadow);
}

.flash.error {
  border-color: #81353c;
}

@media (max-width: 600px) {
  .post-grid {
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    padding: 12px;
  }

  .post-cover {
    height: 145px;
  }

  .page-shell {
    padding: 90px 12px 55px;
  }

  .reading-view {
    padding: 20px;
  }

  .article-header h1 {
    font-size: 38px;
  }

  .article-meta,
  .post-actions,
  .editor-heading,
  .editor-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .article-meta {
    gap: 3px;
  }

  .editor-heading {
    width: calc(100% - 24px);
    padding-top: 90px;
  }

  .editor {
    width: calc(100% - 24px);
    padding: 20px;
  }

  .format-picker {
    grid-template-columns: 1fr;
  }

  .editor-actions button {
    width: 100%;
  }

  .discussion-heading,
  .comment header,
  .comment header > div {
    align-items: flex-start;
    flex-direction: column;
  }

  .discussion-heading .like-button,
  .comment-form button {
    width: 100%;
  }

  .comment-form {
    grid-template-columns: 1fr;
  }

  .comment-form button {
    grid-column: 1;
  }
}

/* The public index keeps the original editorial Blogs design. Article and
   editor pages retain the legacy personal-site styling above. */
.editorial-index {
  --editorial-background: #0c1627;
  --editorial-deep: #08111f;
  --editorial-surface: #151f30;
  --editorial-text: #eef4fb;
  --editorial-soft: #c4cfdd;
  --editorial-muted: #8999ad;
  --editorial-line: #2b3a50;
  --editorial-blue: #65b6df;
  --editorial-yellow: #ffc65c;
  margin: 0;
  background:
    radial-gradient(circle at 75% -10%, rgba(68, 147, 184, .22), transparent 34rem),
    linear-gradient(180deg, var(--editorial-deep), var(--editorial-background) 34rem);
  color: var(--editorial-text);
  font-family: "DM Sans", sans-serif;
  line-height: 1.6;
}

.editorial-index .site-header {
  position: relative;
  z-index: 10;
  display: flex;
  min-height: 76px;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 14px max(24px, calc((100% - 1180px) / 2));
  border-bottom: 1px solid rgba(137, 153, 173, .18);
  background: rgba(8, 17, 31, .78);
}

.editorial-index .brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  color: var(--editorial-text);
  font-size: 15px;
  font-weight: 700;
  text-decoration: none;
}

.editorial-index .brand span {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border: 1px solid rgba(101, 182, 223, .55);
  border-radius: 10px;
  background: rgba(101, 182, 223, .1);
  color: var(--editorial-blue);
  font-size: 13px;
}

.editorial-index .site-header nav {
  display: flex;
  align-items: center;
  gap: 4px;
}

.editorial-index .site-header nav form {
  display: contents;
}

.editorial-index .site-header nav a,
.editorial-index .quiet-button {
  padding: 8px 11px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--editorial-soft);
  font: inherit;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
}

.editorial-index .site-header nav a:hover,
.editorial-index .quiet-button:hover {
  background: rgba(255, 255, 255, .06);
  color: var(--editorial-text);
}

.editorial-index .site-header nav .write-link {
  color: var(--editorial-yellow);
}

.editorial-index .site-header nav .quiet-link {
  color: var(--editorial-muted);
}

.editorial-index main,
.editorial-index .site-footer {
  width: min(1180px, calc(100% - 40px));
  margin: 0 auto;
}

.editorial-index .eyebrow {
  margin: 0 0 11px;
  color: var(--editorial-blue);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .16em;
  text-transform: uppercase;
}

.editorial-index .article-section {
  padding: 54px 0 100px;
  border-top: 1px solid var(--editorial-line);
}

.editorial-index .section-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 32px;
}

.editorial-index .section-heading h2 {
  margin: 0;
  font-family: "Source Serif 4", Georgia, serif;
  font-size: clamp(31px, 4vw, 45px);
}

.editorial-index .admin-note {
  margin: 0 0 5px;
  color: var(--editorial-muted);
  font-size: 13px;
}

.editorial-index .post-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr));
  gap: 22px;
  justify-content: stretch;
  padding: 0;
}

.editorial-index .post-card {
  border: 1px solid var(--editorial-line);
  border-radius: 15px;
  background: var(--editorial-surface);
  box-shadow: 0 12px 35px rgba(0, 0, 0, .12);
  transition: transform .18s, border-color .18s, box-shadow .18s;
}

.editorial-index .post-card:hover {
  transform: translateY(-4px);
  border-color: rgba(101, 182, 223, .55);
  box-shadow: 0 24px 70px rgba(0, 0, 0, .26);
}

.editorial-index .post-cover {
  height: 205px;
  border-radius: 0;
  background: var(--editorial-deep);
}

.editorial-index .post-cover img {
  padding: 10px;
  background: #f5f7fa;
}

.editorial-index .post-card-body {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 0;
  padding: 24px;
}

.editorial-index .post-meta {
  margin: 0;
  color: var(--editorial-muted);
  font-size: 12px;
}

.editorial-index .post-card-body h3 {
  margin: 1px 0 13px;
  font-family: "Source Serif 4", Georgia, serif;
  font-size: 27px;
  line-height: 1.16;
}

.editorial-index .excerpt {
  margin: 0 0 10px;
  color: var(--editorial-soft);
  font-size: 16px;
}

.editorial-index .interaction-summary {
  color: var(--editorial-muted);
  font-size: 12px;
}

.editorial-index .read-more {
  margin-top: auto;
  padding-top: 12px;
  color: var(--editorial-blue);
  font-size: 14px;
  font-weight: 700;
}

.editorial-index .primary-button {
  display: inline-flex;
  min-height: 43px;
  align-items: center;
  justify-content: center;
  padding: 9px 16px;
  border-radius: 8px;
  background: var(--editorial-yellow);
  color: #172033;
  font-weight: 700;
  text-decoration: none;
}

.editorial-index .editorial-empty-state {
  padding: 70px 24px;
  border: 1px dashed var(--editorial-line);
  border-radius: 15px;
  background: rgba(21, 31, 48, .55);
  text-align: center;
}

.editorial-index .editorial-empty-state h2 {
  margin: 0 0 7px;
  font-family: "Source Serif 4", Georgia, serif;
}

.editorial-index .editorial-empty-state > p:not(.empty-mark) {
  color: var(--editorial-muted);
}

.editorial-index .empty-mark {
  display: grid;
  width: 58px;
  height: 58px;
  margin: 0 auto 18px;
  place-items: center;
  border-radius: 50%;
  background: rgba(101, 182, 223, .12);
  color: var(--editorial-blue);
  font-family: "Source Serif 4", Georgia, serif;
}

.editorial-index .site-footer {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  padding: 30px 0 38px;
  border-top: 1px solid var(--editorial-line);
  background: transparent;
  color: var(--editorial-muted);
  font-size: 12px;
}

@media (max-width: 780px) {
  .editorial-index .site-header {
    align-items: flex-start;
    padding: 13px 16px;
  }

  .editorial-index .brand {
    padding-top: 3px;
  }

  .editorial-index .brand:not(:hover) {
    font-size: 0;
  }

  .editorial-index .brand span {
    font-size: 13px;
  }

  .editorial-index .site-header nav {
    flex-wrap: wrap;
    justify-content: flex-end;
  }

  .editorial-index main,
  .editorial-index .site-footer {
    width: min(100% - 26px, 1180px);
  }

  .editorial-index .article-section {
    padding: 42px 0 70px;
  }

  .editorial-index .section-heading,
  .editorial-index .site-footer {
    align-items: stretch;
    flex-direction: column;
  }
}
