/*
 * NEI-K wiki theme for Forgejo.
 * Limited to the NEI-K repository so CCDS repositories keep their own visual language.
 */

:root {
  --neik-gold: #d8ad47;
  --neik-gold-bright: #f4cb68;
  --neik-ink: #17150f;
  --neik-muted: #706957;
  --neik-paper: #fffdf7;
  --neik-line: rgba(140, 107, 32, 0.2);
  --neik-shadow: 0 18px 48px rgba(66, 47, 10, 0.1);
}

body:has(.page-content.repository.wiki) {
  background:
    radial-gradient(circle at 8% 12%, rgba(244, 203, 104, 0.2), transparent 26rem),
    linear-gradient(180deg, #fffdf8 0%, #f8f4e9 100%);
}

.page-content.repository.wiki {
  color: var(--neik-ink);
}

.page-content.repository.wiki > .ui.container {
  width: min(1180px, calc(100% - 32px)) !important;
  margin-top: 28px;
  margin-bottom: 56px;
}

.page-content.repository.wiki .repo-button-row {
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--neik-line);
  border-radius: 18px;
  background: rgba(255, 253, 247, 0.86);
  box-shadow: 0 8px 24px rgba(66, 47, 10, 0.06);
  backdrop-filter: blur(14px);
}

.page-content.repository.wiki .repo-button-row .ui.button,
.page-content.repository.wiki .repo-button-row .ui.input > input {
  min-height: 40px;
  border-radius: 11px !important;
}

.page-content.repository.wiki .repo-button-row .ui.basic.button {
  border-color: rgba(183, 139, 35, 0.35);
  background: #fffaf0;
}

.page-content.repository.wiki .ui.dividing.header {
  position: relative;
  overflow: hidden;
  margin: 18px 0 20px;
  padding: 26px 28px !important;
  border: 1px solid rgba(216, 173, 71, 0.34) !important;
  border-radius: 22px;
  background:
    linear-gradient(115deg, rgba(255, 253, 247, 0.98), rgba(255, 247, 224, 0.96));
  box-shadow: var(--neik-shadow);
}

.page-content.repository.wiki .ui.dividing.header::after {
  content: "NEÏ-K";
  position: absolute;
  top: 50%;
  right: 28px;
  transform: translateY(-50%);
  color: rgba(174, 129, 25, 0.1);
  font-size: clamp(2.5rem, 7vw, 5.5rem);
  font-weight: 900;
  letter-spacing: 0.08em;
  line-height: 1;
  pointer-events: none;
}

.page-content.repository.wiki .ui.dividing.header .column {
  position: relative;
  z-index: 1;
}

.page-content.repository.wiki .ui.dividing.header > .ui.grid > .column:first-child {
  font-size: clamp(1.35rem, 2.5vw, 2rem);
  font-weight: 850;
  letter-spacing: -0.025em;
}

.page-content.repository.wiki .ui.sub.header {
  margin-top: 8px;
  color: var(--neik-muted);
  font-size: 0.82rem;
  font-weight: 500;
}

.page-content.repository.wiki .ui.primary.button {
  border-color: #bd9130 !important;
  background: linear-gradient(135deg, #e2b64f, #c59328) !important;
  color: #18140a !important;
  box-shadow: 0 7px 18px rgba(164, 119, 21, 0.2) !important;
}

.page-content.repository.wiki .ui.primary.button:hover {
  background: linear-gradient(135deg, #f0ca70, #d2a139) !important;
  transform: translateY(-1px);
}

.page-content.repository.wiki .wiki-content-parts {
  align-items: flex-start;
  gap: 20px;
}

.page-content.repository.wiki .wiki-content-main,
.page-content.repository.wiki .wiki-content-sidebar,
.page-content.repository.wiki .wiki-content-footer {
  border: 1px solid var(--neik-line);
  border-radius: 22px;
  background: var(--neik-paper);
  box-shadow: var(--neik-shadow);
}

.page-content.repository.wiki .wiki-content-main {
  min-width: 0;
  padding: clamp(24px, 4vw, 46px);
}

.page-content.repository.wiki .wiki-content-sidebar {
  position: sticky;
  top: 74px;
  padding: 20px;
  background: rgba(255, 253, 247, 0.92);
  box-shadow: 0 12px 30px rgba(66, 47, 10, 0.08);
}

.page-content.repository.wiki .wiki-content-footer {
  margin-top: 20px;
  padding: 18px 24px;
  color: var(--neik-muted);
  text-align: center;
}

.page-content.repository.wiki .markup h1,
.page-content.repository.wiki .markup h2,
.page-content.repository.wiki .markup h3,
.page-content.repository.wiki .markup h4 {
  color: var(--neik-ink);
  font-weight: 800;
  letter-spacing: -0.025em;
}

.page-content.repository.wiki .markup h1 {
  margin-bottom: 1.2rem;
  padding-bottom: 0.75rem;
  border-bottom: 2px solid rgba(216, 173, 71, 0.42);
  font-size: clamp(2rem, 5vw, 3.25rem);
}

.page-content.repository.wiki .markup h2 {
  position: relative;
  margin-top: 2.3rem;
  padding-left: 16px;
  border-bottom: 0;
  font-size: clamp(1.35rem, 3vw, 1.75rem);
}

.page-content.repository.wiki .markup h2::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 5px;
  border-radius: 5px;
  background: linear-gradient(180deg, var(--neik-gold-bright), var(--neik-gold));
}

.page-content.repository.wiki .markup p,
.page-content.repository.wiki .markup li {
  color: #4d493f;
  font-size: 1rem;
  line-height: 1.78;
}

.page-content.repository.wiki .markup a {
  color: #9b6d08;
  font-weight: 650;
  text-decoration-color: rgba(155, 109, 8, 0.35);
  text-underline-offset: 3px;
}

.page-content.repository.wiki .markup a:hover {
  color: #6f4c00;
  text-decoration-color: currentColor;
}

.page-content.repository.wiki .markup blockquote {
  margin: 1.5rem 0;
  padding: 18px 20px;
  border: 1px solid rgba(216, 173, 71, 0.32);
  border-left: 5px solid var(--neik-gold);
  border-radius: 5px 16px 16px 5px;
  background: linear-gradient(115deg, #fff9e9, #fffdf7);
  color: #514831;
}

.page-content.repository.wiki .markup table {
  display: table;
  width: 100%;
  overflow: hidden;
  border: 1px solid var(--neik-line) !important;
  border-radius: 14px;
  border-collapse: separate;
  border-spacing: 0;
  box-shadow: 0 7px 20px rgba(66, 47, 10, 0.05);
}

.page-content.repository.wiki .markup table th {
  border-color: rgba(157, 117, 24, 0.18) !important;
  background: #f5e9c8 !important;
  color: #3b2d0d;
  font-weight: 750;
}

.page-content.repository.wiki .markup table td {
  border-color: rgba(157, 117, 24, 0.12) !important;
  background: rgba(255, 255, 255, 0.66);
}

.page-content.repository.wiki .markup table tr:hover td {
  background: #fff9e8;
}

.page-content.repository.wiki .markup code:not(pre code) {
  border: 1px solid rgba(168, 125, 25, 0.18);
  border-radius: 7px;
  background: #f7efd9;
  color: #5e4204;
}

.page-content.repository.wiki .markup pre {
  border: 1px solid rgba(216, 173, 71, 0.24);
  border-radius: 15px;
  background: #201d17;
  box-shadow: 0 12px 28px rgba(25, 20, 10, 0.13);
}

.page-content.repository.wiki .markup pre code {
  color: #f7efd9;
}

.page-content.repository.wiki .markup img {
  border-radius: 14px;
}

.page-content.repository.wiki .wiki-pages-list {
  overflow: hidden;
  border: 1px solid var(--neik-line) !important;
  border-radius: 18px !important;
  background: var(--neik-paper) !important;
  box-shadow: var(--neik-shadow) !important;
}

.page-content.repository.wiki .wiki-pages-list tr:hover td {
  background: #fff9e8 !important;
}

.page-content.repository.wiki .wiki-pages-list a {
  color: #7b5607;
  font-weight: 700;
}

@keyframes neik-wiki-rise {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

.page-content.repository.wiki .wiki-content-main,
.page-content.repository.wiki .wiki-content-sidebar {
  animation: neik-wiki-rise 420ms ease-out both;
}

.page-content.repository.wiki .wiki-content-sidebar {
  animation-delay: 80ms;
}

@media (max-width: 960px) {
  .page-content.repository.wiki > .ui.container {
    width: calc(100% - 20px) !important;
  }

  .page-content.repository.wiki .repo-button-row {
    flex-wrap: wrap;
  }

  .page-content.repository.wiki .repo-button-row .tw-ml-auto {
    margin-left: 0 !important;
  }

  .page-content.repository.wiki .ui.dividing.header {
    padding: 22px 20px !important;
  }

  .page-content.repository.wiki .ui.dividing.header::after {
    right: 18px;
    font-size: 2.1rem;
  }

  .page-content.repository.wiki .wiki-content-main {
    padding: 22px 18px;
  }

  .page-content.repository.wiki .wiki-content-sidebar {
    position: static;
  }

  .page-content.repository.wiki .markup table {
    display: block;
    overflow-x: auto;
  }
}

@media (prefers-reduced-motion: reduce) {
  .page-content.repository.wiki .wiki-content-main,
  .page-content.repository.wiki .wiki-content-sidebar,
  .page-content.repository.wiki .ui.button {
    animation: none !important;
    transition: none !important;
  }
}

:root[data-theme="forgejo-dark"] body:has(.page-content.repository.wiki),
:root[data-theme="gitea-dark"] body:has(.page-content.repository.wiki) {
  background:
    radial-gradient(circle at 8% 12%, rgba(216, 173, 71, 0.1), transparent 28rem),
    linear-gradient(180deg, #17140f 0%, #100d09 100%);
}

:root[data-theme="forgejo-dark"] .page-content.repository.wiki,
:root[data-theme="gitea-dark"] .page-content.repository.wiki {
  --neik-paper: #181510;
  --neik-line: rgba(216, 173, 71, 0.18);
  --neik-shadow: 0 18px 48px rgba(0, 0, 0, 0.28);
  color: #f4eee1;
}

:root[data-theme="forgejo-dark"] .page-content.repository.wiki .repo-button-row,
:root[data-theme="forgejo-dark"] .page-content.repository.wiki .wiki-content-sidebar,
:root[data-theme="gitea-dark"] .page-content.repository.wiki .repo-button-row,
:root[data-theme="gitea-dark"] .page-content.repository.wiki .wiki-content-sidebar {
  background: rgba(30, 24, 17, 0.9);
}

:root[data-theme="forgejo-dark"] .page-content.repository.wiki .markup p,
:root[data-theme="forgejo-dark"] .page-content.repository.wiki .markup li,
:root[data-theme="gitea-dark"] .page-content.repository.wiki .markup p,
:root[data-theme="gitea-dark"] .page-content.repository.wiki .markup li {
  color: #ddd1bb;
}

:root[data-theme="forgejo-dark"] .page-content.repository.wiki .markup blockquote,
:root[data-theme="gitea-dark"] .page-content.repository.wiki .markup blockquote {
  background: linear-gradient(115deg, rgba(56, 42, 19, 0.72), rgba(29, 24, 17, 0.86));
  color: #eadcc2;
}

:root[data-theme="forgejo-dark"] .page-content.repository.wiki .markup table th,
:root[data-theme="gitea-dark"] .page-content.repository.wiki .markup table th {
  background: #3a2c12 !important;
  color: #f8e8c0;
}

:root[data-theme="forgejo-dark"] .page-content.repository.wiki .markup table td,
:root[data-theme="gitea-dark"] .page-content.repository.wiki .markup table td {
  background: rgba(29, 24, 17, 0.86);
}

:root[data-theme="forgejo-dark"] .page-content.repository.wiki .markup table tr:hover td,
:root[data-theme="gitea-dark"] .page-content.repository.wiki .markup table tr:hover td {
  background: rgba(69, 52, 24, 0.84);
}
