/* =========================================================
   RWY Forgejo custom theme
   ========================================================= */

/* ---------- Palette & typography ---------- */
:root {
  --fonts-proportional: Inter, system-ui, sans-serif !important;
  --fonts-monospace: "JetBrains Mono", monospace !important;

  --rwy-blue: #2f6fa3;
  --rwy-blue-dark: #255983;
  --rwy-blue-soft: #eaf3fb;

  --rwy-green: #2f8f6b;
  --rwy-green-dark: #256f54;
  --rwy-green-soft: #eaf7f1;

  --rwy-label-bg: #eef2f5;
  --rwy-label-border: #d7dee5;
  --rwy-text-dark: #222;
  --rwy-text-muted: #444;
}

/* =========================================================
   Layout
   ========================================================= */

.page-content {
  max-width: 1280px;
  margin: 0 auto;
}

.ui.container {
  max-width: 1100px;
  padding-left: 1rem;
  padding-right: 1rem;
}

.ui.segment,
.ui.menu,
.ui.card {
  border-radius: 12px !important;
}

.ui.button {
  border-radius: 8px !important;
}

.ui.segment,
.ui.menu,
.ui.button {
  box-shadow: none !important;
}

.ui.segment {
  border: 1px solid var(--color-border);
}

.ui.menu {
  border-bottom: 1px solid var(--color-border) !important;
}

.repository .repo-header {
  border-radius: 12px;
}

h1,
h2,
h3 {
  font-weight: 600;
}

/* =========================================================
   Global links
   ========================================================= */

a,
.ui.link.list .item,
.repository .repo-description a,
footer a,
.page-footer a {
  color: var(--rwy-blue) !important;
  text-decoration: none;
}

a:hover,
.ui.link.list .item:hover,
.repository .repo-description a:hover,
footer a:hover,
.page-footer a:hover {
  color: var(--rwy-blue-dark) !important;
  text-decoration: underline;
}

/* =========================================================
   Navigation
   ========================================================= */

/* Menús comunes: evitar tocar secondary/tabular/vertical/navbar */
.ui.menu:not(.secondary):not(.tabular):not(.vertical) .item {
  color: var(--rwy-text-dark) !important;
}

.ui.menu:not(.secondary):not(.tabular):not(.vertical) .active.item,
.ui.menu:not(.secondary):not(.tabular):not(.vertical) .item:hover {
  color: var(--rwy-blue) !important;
}

/* Tabs */
.ui.secondary.pointing.menu .active.item,
.ui.tabular.menu .active.item,
.ui.tabular.menu .item.active {
  color: var(--rwy-blue) !important;
  border-color: var(--rwy-blue) !important;
  border-top-color: var(--rwy-blue) !important;
}

/* =========================================================
   Buttons
   ========================================================= */

.ui.primary.button,
.ui.primary.buttons .button {
  background: var(--rwy-blue) !important;
  border-color: var(--rwy-blue) !important;
  color: #fff !important;
}

.ui.primary.button:hover,
.ui.primary.buttons .button:hover {
  background: var(--rwy-blue-dark) !important;
  border-color: var(--rwy-blue-dark) !important;
}

/* =========================================================
   Labels & states
   ========================================================= */

.ui.label {
  background: var(--rwy-label-bg) !important;
  color: var(--rwy-text-muted) !important;
  border: 1px solid var(--rwy-label-border) !important;
}

a.ui.label:hover,
.ui.label[href]:hover {
  background: var(--rwy-blue-soft) !important;
  color: var(--rwy-blue-dark) !important;
  border-color: #c4d9ec !important;
}

.ui.orange.label,
.ui.basic.orange.label {
  background: var(--rwy-blue-soft) !important;
  color: var(--rwy-blue) !important;
  border-color: #c4d9ec !important;
}

.ui.positive.message,
.ui.green.label,
.ui.basic.green.label {
  background: var(--rwy-green-soft) !important;
  color: var(--rwy-green-dark) !important;
  border-color: #b7ddce !important;
}

/* Neutralize orange/red accents from Forgejo theme */
.text.red,
.ui.red.text,
.ui.orange.text {
  color: var(--rwy-blue) !important;
}

/* =========================================================
   Generic octicons
   ========================================================= */

svg.octicon,
.svg.octicon,
.ui .octicon,
a svg.octicon {
  color: var(--rwy-blue);
  fill: currentColor;
}

a:hover svg.octicon,
.ui:hover .octicon {
  color: var(--rwy-blue-dark);
  fill: currentColor;
}

/* =========================================================
   Homepage hero
   ========================================================= */

.hero.ui.icon.header,
.hero.ui.icon.header a,
.hero.ui.icon.header svg,
.hero.ui.icon.header .octicon,
.hero.ui.icon.header .svg {
  color: var(--rwy-green) !important;
  fill: var(--rwy-green) !important;
}

.hero.ui.icon.header a:hover,
.hero.ui.icon.header:hover,
.hero.ui.icon.header:hover svg {
  color: var(--rwy-green-dark) !important;
  fill: var(--rwy-green-dark) !important;
}

.page.grid .large a {
  color: var(--rwy-blue) !important;
}

.page.grid .large a:hover {
  color: var(--rwy-blue-dark) !important;
}

/* =========================================================
   Repository list (current Forgejo layout)
   ========================================================= */

/* owner / repo names */
.flex-item .flex-item-title a.text.primary.name,
.flex-item-main .flex-item-title a.text.primary.name,
.repo-list .flex-item-title a.text.primary.name {
  color: var(--rwy-blue) !important;
}

.flex-item .flex-item-title a.text.primary.name:hover,
.flex-item-main .flex-item-title a.text.primary.name:hover,
.repo-list .flex-item-title a.text.primary.name:hover {
  color: var(--rwy-blue-dark) !important;
}

/* repo icon */
.flex-item-leading .octicon-repo,
.flex-item-leading svg.octicon-repo,
.flex-item-leading .svg.octicon-repo {
  color: var(--rwy-blue) !important;
  fill: var(--rwy-blue) !important;
}

/* trailing metadata: language / stars / forks */
.flex-item-trailing a,
.flex-item-trailing a svg,
.muted-links a,
.muted-links a svg {
  color: var(--rwy-blue) !important;
  fill: currentColor !important;
}

.flex-item-trailing a:hover,
.flex-item-trailing a:hover svg,
.muted-links a:hover,
.muted-links a:hover svg {
  color: var(--rwy-blue-dark) !important;
  fill: currentColor !important;
}

/* fallback for repo title contexts in other views */
.repository .repo-title,
.repository .repo-title a,
.repository .repo-title svg,
.repository .repo-title .octicon,
.explore .repo-title,
.explore .repo-title a,
.explore .repo-title svg,
.explore .repo-title .octicon {
  color: var(--rwy-blue) !important;
  fill: var(--rwy-blue) !important;
}

.repository .repo-title a:hover,
.repository .repo-title a:hover svg,
.explore .repo-title a:hover,
.explore .repo-title a:hover svg {
  color: var(--rwy-blue-dark) !important;
  fill: var(--rwy-blue-dark) !important;
}

/* =========================================================
   Dark mode palette helpers
   ========================================================= */

html[data-theme="dark"] {
  --rwy-text-dark: #cbd5e1;
  --rwy-text-muted: #94a3b8;
}

/* =========================================================
   Dark mode fixes - navbar real de Forgejo
   ========================================================= */

html[data-theme="dark"] #navbar {
  background: transparent;
}

html[data-theme="dark"] #navbar .ui.secondary.menu > a.item,
html[data-theme="dark"] #navbar .ui.secondary.menu > .item > a,
html[data-theme="dark"] #navbar a.item:not(.active) {
  color: #94a3b8 !important;
}

html[data-theme="dark"] #navbar a.item:not(.active) span {
  color: inherit !important;
}

html[data-theme="dark"] #navbar a.item:not(.active) svg,
html[data-theme="dark"] #navbar a.item:not(.active) .octicon,
html[data-theme="dark"] #navbar a.item:not(.active) .svg {
  color: currentColor !important;
  fill: currentColor !important;
}

html[data-theme="dark"] #navbar .ui.secondary.menu > a.item:hover,
html[data-theme="dark"] #navbar a.item:not(.active):hover {
  color: #e2e8f0 !important;
}

html[data-theme="dark"] #navbar a.item.active,
html[data-theme="dark"] #navbar .ui.secondary.menu > a.item.active {
  color: #60a5fa !important;
}

html[data-theme="dark"] #navbar-logo,
html[data-theme="dark"] #navbar-logo:hover {
  color: inherit !important;
}

/* =========================================================
   Dark mode fixes - tabs
   ========================================================= */

html[data-theme="dark"] .ui.secondary.pointing.menu .item:not(.active),
html[data-theme="dark"] .ui.tabular.menu .item:not(.active) {
  color: #94a3b8 !important;
}

html[data-theme="dark"] .ui.secondary.pointing.menu .item:not(.active):hover,
html[data-theme="dark"] .ui.tabular.menu .item:not(.active):hover {
  color: #e2e8f0 !important;
}

html[data-theme="dark"] .ui.secondary.pointing.menu .active.item,
html[data-theme="dark"] .ui.tabular.menu .active.item,
html[data-theme="dark"] .ui.tabular.menu .item.active {
  color: #60a5fa !important;
  border-color: #60a5fa !important;
  border-top-color: #60a5fa !important;
}

html[data-theme="dark"] .ui.secondary.pointing.menu .item svg,
html[data-theme="dark"] .ui.tabular.menu .item svg,
html[data-theme="dark"] .ui.secondary.pointing.menu .item .octicon,
html[data-theme="dark"] .ui.tabular.menu .item .octicon {
  color: currentColor !important;
  fill: currentColor !important;
}

/* =========================================================
   Dark mode fixes - menú lateral vertical
   ========================================================= */

html[data-theme="dark"] .ui.fluid.vertical.menu,
html[data-theme="dark"] .ui.vertical.menu {
  background: transparent !important;
  border-color: var(--color-border) !important;
}

html[data-theme="dark"] .ui.fluid.vertical.menu > .header.item,
html[data-theme="dark"] .ui.vertical.menu > .header.item {
  color: #e2e8f0 !important;
  background: transparent !important;
}

html[data-theme="dark"] .ui.fluid.vertical.menu > a.item:not(.active),
html[data-theme="dark"] .ui.vertical.menu > a.item:not(.active),
html[data-theme="dark"] .ui.fluid.vertical.menu > details.item > summary,
html[data-theme="dark"] .ui.vertical.menu > details.item > summary {
  color: #94a3b8 !important;
  background: transparent !important;
}

html[data-theme="dark"] .ui.fluid.vertical.menu > a.item:not(.active):hover,
html[data-theme="dark"] .ui.vertical.menu > a.item:not(.active):hover,
html[data-theme="dark"] .ui.fluid.vertical.menu > details.item > summary:hover,
html[data-theme="dark"] .ui.vertical.menu > details.item > summary:hover {
  color: #e2e8f0 !important;
  background: rgba(148, 163, 184, 0.08) !important;
}

html[data-theme="dark"] .ui.fluid.vertical.menu > a.item.active,
html[data-theme="dark"] .ui.vertical.menu > a.item.active {
  color: #60a5fa !important;
  background: rgba(96, 165, 250, 0.10) !important;
}

html[data-theme="dark"] .ui.fluid.vertical.menu > a.item svg,
html[data-theme="dark"] .ui.vertical.menu > a.item svg,
html[data-theme="dark"] .ui.fluid.vertical.menu > details.item > summary svg,
html[data-theme="dark"] .ui.vertical.menu > details.item > summary svg,
html[data-theme="dark"] .ui.fluid.vertical.menu > a.item .octicon,
html[data-theme="dark"] .ui.vertical.menu > a.item .octicon,
html[data-theme="dark"] .ui.fluid.vertical.menu > details.item > summary .octicon,
html[data-theme="dark"] .ui.vertical.menu > details.item > summary .octicon {
  color: currentColor !important;
  fill: currentColor !important;
}

/* submenús internos */
html[data-theme="dark"] .ui.fluid.vertical.menu details.item .menu,
html[data-theme="dark"] .ui.vertical.menu details.item .menu {
  background: transparent !important;
}

html[data-theme="dark"] .ui.fluid.vertical.menu details.item .menu a.item,
html[data-theme="dark"] .ui.vertical.menu details.item .menu a.item {
  color: #94a3b8 !important;
  background: transparent !important;
}

html[data-theme="dark"] .ui.fluid.vertical.menu details.item .menu a.item:hover,
html[data-theme="dark"] .ui.vertical.menu details.item .menu a.item:hover {
  color: #e2e8f0 !important;
  background: rgba(148, 163, 184, 0.08) !important;
}

html[data-theme="dark"] .ui.fluid.vertical.menu details.item .menu a.item.active,
html[data-theme="dark"] .ui.vertical.menu details.item .menu a.item.active {
  color: #60a5fa !important;
  background: rgba(96, 165, 250, 0.10) !important;
}

/* summary marker / disclosure */
html[data-theme="dark"] .ui.fluid.vertical.menu details.item > summary,
html[data-theme="dark"] .ui.vertical.menu details.item > summary {
  list-style: none;
}

html[data-theme="dark"] .ui.fluid.vertical.menu details.item > summary::-webkit-details-marker,
html[data-theme="dark"] .ui.vertical.menu details.item > summary::-webkit-details-marker {
  display: none;
}
