/* Small overrides on top of the PaperMod-derived stylesheet. */

.profile-meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
  max-width: 70ch;
  color: var(--secondary);
  line-height: 1.35;
}

.profile-meta .profile-role {
  color: var(--primary);
  font-weight: var(--semibold);
}

.profile-desc {
  max-width: 70ch;
}

.home-main {
  padding-top: 18px;
}

.home-profile {
  align-items: flex-start !important;
  min-height: auto !important;
  padding: 0 !important;
  margin-bottom: 20px;
}

.home-highlights-section {
  margin-top: 34px;
  padding: 0;
}

.home-highlights-inner {
  max-width: 70ch;
}

.home-highlights-header {
  margin: 0 auto 12px !important;
}

.home-highlights-header h2 {
  font-size: 1.5rem;
  font-weight: 400;
}

.home-highlight-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px 16px;
  align-items: stretch;
}

.home-highlight-grid .post-entry {
  margin-bottom: 0 !important;
  height: 100%;
}

.home-highlight-grid .catalog-card {
  padding: 12px 15px 14px !important;
}

.home-highlight-grid .card-kicker {
  margin-bottom: 7px;
  font-size: 11px;
  letter-spacing: 0.06em;
}

.home-highlight-grid .entry-header h2 {
  font-size: 1.08rem;
  font-weight: 400;
  line-height: 1.25;
}

.home-highlight-grid .catalog-card .entry-content {
  margin-top: 7px !important;
}

.home-highlight-grid .catalog-card .entry-content p {
  color: var(--secondary);
  font-size: 0.98em;
}

.profile-avatar {
  object-fit: contain;
  object-position: center;
  background: transparent;
  padding: 0;
}

.profile img.profile-avatar {
  border: 0 !important;
  border-radius: 28px !important;
  box-shadow: none;
}

.social-icons img,
.social-icons svg {
  height: 30px;
  width: 30px;
}

.orcid-mark {
  display: inline-block;
  width: 30px;
  height: 30px;
  background: currentColor;
  -webkit-mask: url("/assets/img/orcid-icon-original.svg") center/contain no-repeat;
  mask: url("/assets/img/orcid-icon-original.svg") center/contain no-repeat;
}

.social-icons a {
  align-items: center;
}

.profile .social-icons img,
.profile .social-icons svg {
  border: 0;
  border-radius: 0;
  transform: none;
}

/* Card base */
.post-entry {
  margin-bottom: 18px !important;
  padding: 14px 20px 20px !important;
  border: 1px solid var(--border) !important;
  border-radius: 12px !important;
}

.post-entry.is-clickable:hover {
  border: 1px solid var(--darkcolor) !important;
}

.post-entry.is-static:hover {
  border: 1px solid var(--border) !important;
}

.entry-content {
  margin: 8px 0 0 !important;
}

.entry-footer {
  margin-top: 14px !important;
}

.page-header,
.post-header {
  margin: 16px auto 12px !important;
}

.post-content h2 {
  margin: 20px auto 14px !important;
}

.post-content .buttons {
  margin: 8px 0 18px !important;
}

.pub-marker-note {
  margin: 6px 0 12px;
  color: var(--secondary);
  font-size: var(--entrysize);
}

.button {
  box-shadow: none !important;
}

.buttons .button,
.buttons .button:hover,
.buttons .button:focus,
.buttons .button:active,
.post-content .buttons a,
.post-content .buttons a:hover,
.post-content .buttons a:focus,
.post-content .buttons a:active {
  box-shadow: none !important;
}

.post-content a.button,
.post-content a.button:hover,
.post-content a.button:focus,
.post-content a.button:active {
  box-shadow: none !important;
}

.post-content .entry-link,
.post-content .entry-link:hover,
.post-content .entry-link:focus,
.post-content .entry-link:active {
  box-shadow: none !important;
}

/* Publication card */
.pub-entry .entry-content {
  display: block;
  -webkit-line-clamp: unset;
  overflow: visible;
}

.pub-entry .pub-cite {
  color: var(--primary);
  font-size: var(--entrysize);
  line-height: 1.55;
}

.pub-entry .pub-authors {
  font-weight: 400;
}

.pub-entry .pub-authors strong {
  font-weight: var(--semibold);
}

.pub-entry .pub-venue {
  margin-top: 4px;
}

.pub-entry .pub-links {
  margin-top: 4px;
  color: var(--primary);
  font-size: var(--entrysize);
}

.pub-entry .pub-links a {
  word-break: break-all;
}

.pub-entry .pub-note {
  margin-top: 10px;
  color: var(--secondary);
  font-size: var(--entrysize);
}

.section-intro {
  margin: 2px 0 18px;
  max-width: 72ch;
  color: var(--secondary);
}

/* Catalog card */
.catalog-grid {
  display: block;
}

.catalog-grid .post-entry {
  margin-bottom: 18px !important;
}

.catalog-grid .post-entry:last-child {
  margin-bottom: 0 !important;
}

.catalog-card {
  padding: 16px 20px 20px !important;
}

.card-clickable {
  cursor: pointer;
}

.post-entry.is-clickable:focus-visible,
.card-clickable:focus-visible {
  outline: 2px solid var(--darkcolor);
  outline-offset: 3px;
}

.catalog-card .entry-header,
.catalog-card .entry-footer {
  margin: 0;
}

.catalog-card .entry-content {
  margin-top: 10px !important;
}

.catalog-card .entry-content p {
  margin: 0;
}

@media (max-width: 768px) {
  .home-main {
    padding-top: 14px;
  }

  .home-profile {
    margin-bottom: 18px;
  }

  .home-highlights-section {
    margin-top: 28px;
  }

  .home-highlight-grid {
    grid-template-columns: 1fr;
  }
}

.card-kicker {
  margin-bottom: 10px;
  color: var(--gray);
  font-size: 13px;
  font-weight: var(--semibold);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.card-tags,
.card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.card-tags {
  margin-top: 14px;
}

.card-tag {
  display: inline-flex;
  align-items: center;
  padding: 5px 10px;
  border-radius: 999px;
  background: var(--code-bg);
  color: var(--secondary);
  font-size: 13px;
  line-height: 1;
}

.card-actions {
  margin-top: 16px;
}

.card-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 8px 14px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--entry);
  color: var(--primary);
  font-size: 14px;
  font-weight: var(--semibold);
  line-height: 1.2;
  box-shadow: none !important;
  text-decoration: none;
  transition:
    border-color 0.15s ease,
    background 0.15s ease,
    color 0.15s ease;
}

.card-link:hover,
.card-link:focus-visible {
  border-color: var(--darkcolor);
  color: var(--darkcolor);
  box-shadow: none !important;
}

.card-link.primary {
  border-color: var(--primary);
  background: var(--primary);
  color: var(--theme);
}

.card-link.primary:hover,
.card-link.primary:focus-visible {
  border-color: var(--darkcolor);
  background: var(--darkcolor);
  color: var(--theme);
}

button.card-link {
  appearance: none;
  cursor: pointer;
}

.card-media {
  margin-top: 16px;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--code-bg);
}

.card-media img {
  width: 100%;
  height: auto;
}

.card-media-plain {
  overflow: visible;
  border: 0;
  border-radius: 0;
  background: transparent;
}

.play-card-media {
  max-width: 420px;
  margin-top: 12px;
}

.play-card-media img {
  border-radius: 10px;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 10px;
  margin-top: 16px;
}

.metric-box {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 12px;
  border-radius: 10px;
  background: var(--code-bg);
  border: 1px solid var(--border);
}

.metric-label {
  color: var(--secondary);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.metric-value {
  color: var(--primary);
  font-size: 16px;
  line-height: 1.2;
}

.detail-shell {
  display: flex;
  flex-direction: column;
}

.demo-main {
  max-width: calc(980px + var(--gap) * 2);
}

.back-link {
  margin: 0 0 14px;
  font-size: 14px;
}

.back-link a {
  color: var(--secondary);
  box-shadow: none !important;
}

.back-link a:hover,
.back-link a:focus-visible {
  color: var(--darkcolor);
}

.detail-lead {
  max-width: 74ch;
  margin: 6px 0 0;
  color: var(--secondary);
}

.detail-section {
  margin-top: 24px;
}

.detail-section:first-of-type {
  margin-top: 10px;
}

.detail-section h2 {
  margin: 0 0 10px !important;
}

.detail-section p:last-child {
  margin-bottom: 0;
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
}

.detail-panel {
  padding: 16px 18px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--entry);
}

.detail-panel h3 {
  margin: 0 0 8px;
  font-size: 20px;
}

.detail-panel p:last-child {
  margin-bottom: 0;
}

.detail-list {
  margin: 12px 0 0;
  padding-left: 18px;
  color: var(--secondary);
}

.detail-list li + li {
  margin-top: 8px;
}

.detail-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.detail-note {
  margin-top: 12px;
  color: var(--secondary);
  font-size: var(--entrysize);
}

.link-list {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
}

.segment-group {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.segment-button {
  appearance: none;
  min-height: 40px;
  padding: 8px 14px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--entry);
  color: var(--primary);
  font-size: 14px;
  font-weight: var(--semibold);
  line-height: 1.2;
  cursor: pointer;
  transition:
    border-color 0.15s ease,
    background 0.15s ease,
    color 0.15s ease;
}

.segment-button:hover,
.segment-button:focus-visible {
  border-color: var(--darkcolor);
  color: var(--darkcolor);
  background: var(--entry);
}

.segment-button.is-active {
  border-color: var(--lightcolor);
  background: var(--lightcolor);
  color: var(--primary);
  box-shadow: none;
}

.segment-button.is-active:hover,
.segment-button.is-active:focus-visible {
  border-color: var(--darkcolor);
  background: var(--lightcolor);
  color: var(--darkcolor);
}

.embed-panel {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.play-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
}

.play-toolbar-divider {
  width: 1px;
  height: 30px;
  background: var(--primary);
  opacity: 0.72;
}

.embed-shell {
  width: 100%;
  max-width: 1040px;
  min-height: 560px;
  max-height: 760px;
  aspect-ratio: 16 / 10;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--entry);
}

.demo-frame {
  width: 100%;
  height: 100%;
  border: 0;
  background: var(--entry);
}

.forge-lab-shell {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.forge-sample-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.forge-toolbar-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.forge-toolbar-field--wide {
  flex: 0 0 240px;
  max-width: 240px;
}

.forge-select {
  min-height: 42px;
  width: 100%;
  padding: 9px 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--entry);
  color: var(--primary);
  font-size: 15px;
  font-weight: var(--semibold);
  line-height: 1.4;
}

.forge-toolbar-actions {
  display: flex;
  flex-wrap: nowrap;
  gap: 10px;
}

.forge-panel-header {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 12px;
}

.forge-status-badge[data-status="idle"] {
  background: var(--code-bg);
  color: var(--secondary);
}

.forge-status-badge[data-status="loadingRuntime"],
.forge-status-badge[data-status="running"] {
  background: rgba(94, 66, 188, 0.12);
  color: var(--darkcolor);
}

.forge-status-badge[data-status="ready"] {
  background: rgba(25, 135, 84, 0.12);
  color: #1b7f52;
}

.forge-status-badge[data-status="error"] {
  background: rgba(176, 44, 44, 0.12);
  color: #9d1f1f;
}

.forge-sample-meta {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px 18px;
}

.forge-sample-meta p {
  margin: 0;
  word-break: normal;
  overflow-wrap: break-word;
}

.forge-sample-meta h3,
.forge-editor-panel h3,
.forge-output-panel h3 {
  margin: 0;
  font-size: 18px;
}

.forge-playground-grid {
  display: grid;
  grid-template-columns: minmax(0, 3fr) minmax(320px, 2fr);
  gap: 16px;
}

.forge-editor-panel,
.forge-output-panel {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
  padding: 16px 18px;
}

.forge-editor-host {
  min-height: 420px;
  background: var(--code-bg);
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--border);
}

.forge-editor-host .cm-editor {
  height: 100%;
}

.forge-editor-host .cm-scroller {
  scrollbar-gutter: stable;
}

.lab-console {
  min-height: 420px;
  margin: 0;
  padding: 14px;
  overflow-x: auto;
  border-radius: 12px;
  background: var(--code-bg);
  color: var(--primary);
  font-family: Consolas, "Cascadia Mono", "SFMono-Regular", Menlo, Monaco, "Liberation Mono", monospace;
  font-size: 14px;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-word;
}

.bench-stack {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.bench-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
}

.bench-card {
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--entry);
}

.bench-card h3 {
  margin: 0 0 10px;
  font-size: 18px;
}

.bench-table {
  width: 100%;
  border-collapse: collapse;
}

.bench-table th,
.bench-table td {
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  text-align: left;
  font-size: 14px;
}

.bench-table th {
  color: var(--gray);
  font-weight: var(--semibold);
}

.bench-table td:last-child {
  text-align: right;
  color: var(--primary);
}

.bench-notes {
  margin: 0;
  padding-left: 18px;
  color: var(--secondary);
}

.bench-notes li + li {
  margin-top: 6px;
}

.status-panel {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
}

.status-chip {
  display: inline-flex;
  align-items: center;
  padding: 6px 10px;
  border-radius: 999px;
  background: var(--code-bg);
  color: var(--secondary);
  font-size: 13px;
  line-height: 1;
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 16px;
  margin: auto var(--gap);
}

.nav-actions #menu {
  margin: 0;
}

.menu-locale {
  position: relative;
  display: flex;
  align-items: center;
  flex: 0 0 auto;
}

.menu-locale-trigger {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  padding: 0 6px 0 10px;
  border: 1px solid transparent;
  border-radius: 999px;
  background: transparent;
  color: var(--primary);
  font-size: var(--headersize);
  line-height: 1.2;
  cursor: pointer;
  user-select: none;
  transition:
    color 0.15s ease,
    background 0.15s ease,
    border-color 0.15s ease;
}

.menu-locale-trigger:hover,
.menu-locale-trigger:focus-visible,
.menu-locale-trigger[aria-expanded="true"] {
  color: var(--darkcolor);
  border-color: var(--border);
  background: var(--entry);
  outline: none;
}

.menu-locale-trigger-label {
  font-weight: 400;
}

.menu-locale-trigger-chevron {
  width: 8px;
  height: 8px;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: rotate(45deg) translateY(-1px);
  transition: transform 0.15s ease;
}

.menu-locale-trigger[aria-expanded="true"] .menu-locale-trigger-chevron {
  transform: rotate(-135deg) translateY(-1px);
}

.menu-locale-popover {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 144px;
  padding: 6px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--entry);
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.08);
  z-index: 50;
}

.menu-locale-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.menu-locale-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 10px;
  border-radius: 10px;
  color: var(--primary);
  font-size: 14px;
  line-height: 1.3;
  box-shadow: none !important;
}

.menu-locale-option:hover,
.menu-locale-option:focus-visible {
  color: var(--darkcolor);
  background: var(--code-bg);
  outline: none;
}

.menu-locale-option.is-active {
  color: var(--darkcolor);
  background: rgba(94, 66, 188, 0.08);
}

.menu-locale-option-mark {
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: transparent;
  flex: 0 0 auto;
}

.menu-locale-option.is-active .menu-locale-option-mark {
  background: var(--darkcolor);
}

.locale-gate-shell {
  min-height: 100vh;
}

.locale-gate {
  max-width: 760px;
  margin: 72px auto;
}

.locale-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
  margin-top: 18px;
}

.locale-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--entry);
  color: var(--primary);
  text-decoration: none;
  box-shadow: none !important;
}

.locale-card:hover,
.locale-card:focus-visible {
  border-color: var(--darkcolor);
  color: var(--darkcolor);
}

@media screen and (max-width: 768px) {
  .play-toolbar-divider {
    display: none;
  }

  .embed-shell {
    min-height: 420px;
    aspect-ratio: 4 / 3;
  }

  .forge-playground-grid {
    grid-template-columns: 1fr;
  }

  .forge-sample-toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .forge-toolbar-field--wide {
    flex-basis: auto;
    max-width: none;
  }

  .forge-toolbar-actions {
    width: 100%;
    flex-wrap: wrap;
  }

  .forge-toolbar-actions .card-link {
    flex: 1 1 calc(50% - 10px);
  }

  .nav-actions {
    width: 100%;
    justify-content: space-between;
    margin: 0 var(--gap) auto;
    gap: 12px;
  }

  .nav-actions #menu {
    min-width: 0;
  }

  .menu-locale-popover {
    right: 0;
    min-width: 132px;
  }
}
