/*
 * Primal - Crusalis Primal season theme (overlay on Cobalt).
 * Loads after cobalt.css and primal-tokens.css.
 *
 * Palette is lifted from the season key art: canopy greens, the amber dusk sky,
 * the red PRIMAL plaque and the teal glow of the obelisk.
 * Signature: pixel-notched corners (the key art is pixel art) and the obelisk-teal marker.
 */

@font-face {
  font-family: "Barlow Condensed";
  src: url("../fonts/barlow-condensed-600.woff2") format("woff2");
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}

/* ---------- tokens ---------- */
:root {
  color-scheme: dark;
  --pr-bg: #10160f;          /* canopy at night */
  --pr-surface: #172017;
  --pr-surface-2: #1d281d;
  --pr-raised: #243124;
  --pr-line: #34442f;
  --pr-line-2: #4a5c41;
  --pr-text: #efe6cf;        /* bone */
  --pr-text-2: #cbc5ab;
  --pr-text-3: #a0a68d;
  --pr-ink: #efe6cf;         /* overlay tint source */
  --pr-ember: #c9341a;       /* the PRIMAL plaque */
  --pr-ember-deep: #a32812;
  --pr-amber: #e9b25f;       /* dusk sky */
  --pr-teal: #63d6c6;        /* obelisk glow */
  --pr-link: var(--pr-amber);
  --pr-hero-ink: #f6eed9;    /* text that sits on the key art, same in both schemes */
  --pr-notch: 6px;
  --pr-display: "Barlow Condensed", "Arial Narrow", "Roboto Condensed", sans-serif;
  --p-color: var(--pr-ember);
}

/* Light = sandstone at midday. Applies on OS preference unless the visitor chose dark. */
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    color-scheme: light;
    --pr-bg: #e9dfc6;
    --pr-surface: #f7f1e0;
    --pr-surface-2: #f0e8d2;
    --pr-raised: #e6dcc2;
    --pr-line: #cdbf9d;
    --pr-line-2: #a99a74;
    --pr-text: #1c2618;
    --pr-text-2: #3a4733;
    --pr-text-3: #56604b;
    --pr-ink: #1c2618;
    --pr-ember: #b02a12;
    --pr-ember-deep: #8f210d;
    --pr-amber: #7a4d08;
    --pr-teal: #0b6a60;
    --pr-link: #9c2410;
  }
}
:root[data-theme="light"] {
  color-scheme: light;
  --pr-bg: #e9dfc6;
  --pr-surface: #f7f1e0;
  --pr-surface-2: #f0e8d2;
  --pr-raised: #e6dcc2;
  --pr-line: #cdbf9d;
  --pr-line-2: #a99a74;
  --pr-text: #1c2618;
  --pr-text-2: #3a4733;
  --pr-text-3: #56604b;
  --pr-ink: #1c2618;
  --pr-ember: #b02a12;
  --pr-ember-deep: #8f210d;
  --pr-amber: #7a4d08;
  --pr-teal: #0b6a60;
  --pr-link: #9c2410;
}

/* ---------- base ---------- */
html, body { background-color: var(--pr-bg); }
body { color: var(--pr-text-2); }
::selection { background: var(--pr-teal); color: #0c1210; }

a, a:hover, a:focus,
.header-theme, .news-title, .top-text, .error-title, .lr-title, .p-icon, .theme-text,
.mcs-server-name { color: var(--pr-link); }
a:hover { text-decoration-color: currentColor; }

:focus-visible {
  outline: 2px solid var(--pr-teal) !important;
  outline-offset: 2px;
}

h1, h2, h3, h4,
.post-card-title, .post-name, .cf-full-post-title, .more-posts,
.footer-text-header, .widget-header-txt, .welcome-title, .error-title, .lr-title,
.store-box .title, .pr-tile-title {
  font-family: var(--pr-display);
  font-weight: 600;
  letter-spacing: 0.01em;
  line-height: 1.12;
}

/* Elements that carry a filled ember background keep light text in both schemes. */
.btn-theme, .btn-theme:hover, .btn-theme:focus, .badge-theme,
.page-item.active .page-link, .nav-link.store-link, .nav-link.store-link:hover,
.modal-header, .modal-header .modal-title, .modal-header .close,
.swal2-styled.swal2-confirm, .referrals .copy-text button,
.spoiler .spoiler-toggle, .spoiler .spoiler-title,
.cc-window.cc-floating .cc-highlight .cc-btn.cc-allow,
.store-box, .store-box * { color: #fff !important; }

html .page-item.active .page-link, html .user-nav-link.active, html .profile-about-box,
html .rules-menu-link.active { border-color: var(--pr-ember) !important; }

/* ---------- hero: the key art, unblurred and pixel-crisp ---------- */
.color-overlay { background: var(--pr-bg) !important; }
html .header,
html.webp .header,
html.no-webp .header {
  background: #1a2418 url("../img/primal-banner.png") center 42% / cover no-repeat !important;
  filter: none !important;
  opacity: 1 !important;
  image-rendering: pixelated;
}
html.webp .header { background-image: url("../img/primal-banner.webp") !important; }
/* top shade keeps the nav legible; bottom fades the art into the page */
.header:after { background: linear-gradient(rgba(8, 12, 8, 0.72), rgba(8, 12, 8, 0)) !important; }
.header:before { background: linear-gradient(rgba(16, 22, 15, 0) 62%, var(--pr-bg)) !important; }

/* The logo is painted into the key art; keep Cobalt's logo link as the click target only. */
.logo-container .logo { opacity: 0 !important; animation: none !important; }
#logo-link { display: block; }

/* status + discord boxes sit on the art */
.status-text .text, .discord-text .text,
.status-text .bottom-text, .discord-text .bottom-text {
  color: var(--pr-hero-ink) !important;
  text-shadow: 0 1px 0 #000, 0 0 10px rgba(0, 0, 0, 0.75);
}
.status-text .top-text, .discord-text .top-text,
.status-text .top-text *, .discord-text .top-text * {
  color: #ffd98a !important;
  font-family: var(--pr-display);
  font-size: 1.05rem;
  letter-spacing: 0.04em;
}
.status-text .icon:after, .discord-text .icon:after { background-color: var(--pr-teal) !important; }
.discord-text .st0, .status-text path, .discord-icon .st0, .status-icon path { fill: var(--pr-hero-ink) !important; }

/* ---------- navigation ---------- */
.navbar-top-new .nav-link, .navbar-bottom .nav-link {
  font-family: var(--pr-display);
  font-size: 1.12rem;
  letter-spacing: 0.05em;
}
@media (min-width: 992px) {
  .navbar-top-new .navbar-nav > .nav-item > .nav-link:not(.store-link) {
    color: var(--pr-hero-ink) !important;
    text-shadow: 0 1px 0 rgba(0, 0, 0, 0.9), 0 0 12px rgba(0, 0, 0, 0.6);
    opacity: 0.86;
  }
  .navbar-top-new .navbar-nav > .nav-item > .nav-link:not(.store-link):hover,
  .navbar-top-new .navbar-nav > .nav-item.active > .nav-link:not(.store-link) {
    opacity: 1;
    box-shadow: inset 0 -3px 0 var(--pr-teal);
  }
}
html .nav-link.store-link {
  background-color: var(--pr-ember) !important;
  border-radius: 0 !important;
  clip-path: polygon(0 4px, 4px 4px, 4px 0, calc(100% - 4px) 0, calc(100% - 4px) 4px, 100% 4px, 100% calc(100% - 4px), calc(100% - 4px) calc(100% - 4px), calc(100% - 4px) 100%, 4px 100%, 4px calc(100% - 4px), 0 calc(100% - 4px));
}
html .navbar-top-new .store-link:after, html .navbar-bottom .store-link:after { box-shadow: none !important; }

/* ---------- pixel-notched blocks ---------- */
.post-card-large, .post-card-medium, .post-card-small,
.cf-full-post, .welcome-card, .store-box, .pr-tile,
.btn-theme, .btn-play, .btn-secondary, .pr-theme-toggle {
  border-radius: 0 !important;
  clip-path: polygon(
    0 var(--pr-notch), var(--pr-notch) var(--pr-notch), var(--pr-notch) 0,
    calc(100% - var(--pr-notch)) 0, calc(100% - var(--pr-notch)) var(--pr-notch), 100% var(--pr-notch),
    100% calc(100% - var(--pr-notch)), calc(100% - var(--pr-notch)) calc(100% - var(--pr-notch)), calc(100% - var(--pr-notch)) 100%,
    var(--pr-notch) 100%, var(--pr-notch) calc(100% - var(--pr-notch)), 0 calc(100% - var(--pr-notch)));
}
.btn-theme, .btn-play, .btn-secondary, .pr-theme-toggle, .nav-link.store-link { --pr-notch: 4px; }
.post-card-img, .post-card-img img, .cf-full-post-img { border-radius: 0 !important; }

.btn-theme {
  font-family: var(--pr-display);
  font-size: 1.05rem;
  letter-spacing: 0.04em;
  border: 0 !important;
}
.btn-theme:hover { background-color: var(--pr-ember-deep) !important; filter: none !important; }

/* ---------- welcome card + store plaque ---------- */
.welcome-card { background-color: var(--pr-surface) !important; border: 0 !important; }
.welcome-title { color: var(--pr-link) !important; font-size: 1.5rem; }
.welcome-text { color: var(--pr-text-2) !important; }
html .store-box {
  border: 0 !important;
  box-shadow: none !important;
  background: linear-gradient(180deg, var(--pr-ember), var(--pr-ember-deep)) !important;
}

/* ---------- home quick links ---------- */
.pr-quick {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin: 4px 0 26px;
}
.pr-tile {
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 84px;
  padding: 14px 16px;
  background: var(--pr-surface);
  color: var(--pr-text) !important;
  text-decoration: none !important;
  border-bottom: 3px solid var(--pr-line);
  transition: background-color 0.12s ease, border-color 0.12s ease;
}
.pr-tile:hover, .pr-tile:focus-visible { background: var(--pr-raised); border-bottom-color: var(--pr-teal); }
.pr-glyph { flex: 0 0 40px; width: 40px; height: 40px; fill: var(--pr-amber); }
.pr-tile:hover .pr-glyph { fill: var(--pr-teal); }
.pr-tile-text { display: flex; flex-direction: column; min-width: 0; }
.pr-tile-title { font-size: 1.35rem; color: var(--pr-text); }
.pr-tile-desc { font-size: 0.86rem; line-height: 1.35; color: var(--pr-text-3); }
@media (max-width: 991px) { .pr-quick { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 520px) {
  .pr-quick { grid-template-columns: 1fr; gap: 10px; }
  .pr-tile { min-height: 68px; }
}

/* ---------- news cards ---------- */
.post-card-large, .post-card-medium, .post-card-small { background-color: var(--pr-surface) !important; }
.post-list .post-card-img { background-color: var(--pr-surface-2); }
.post-card-title a, .post-card-title .post-name { color: var(--pr-link) !important; }
.post-card-large .post-name { font-size: 2.1rem; }
.post-card-medium .post-name { font-size: 1.6rem; }
.post-card-small .post-name { font-size: 1.4rem; }
.post-card-content { color: var(--pr-text-2) !important; }
.readtime { border-radius: 0 !important; color: var(--pr-text-2) !important; }

/* full post */
.cf-full-post-title { font-size: clamp(1.9rem, 4.2vw, 3rem); color: var(--pr-text) !important; }
.cf-full-post-content { color: var(--pr-text-2); font-size: 1.02rem; line-height: 1.7; }
.cf-full-post-content > * { max-width: 74ch; }
.cf-full-post-content h2, .cf-full-post-content h3 { color: var(--pr-text); margin: 1.6em 0 0.5em; }
.cf-full-post-content h2 { font-size: 1.9rem; }
.cf-full-post-content h3 { font-size: 1.45rem; }
.cf-full-post-content img { max-width: 100%; height: auto; }
.cf-full-post-content figure { margin: 1.4em 0; }
.cf-full-post-content figcaption { font-size: 0.86rem; color: var(--pr-text-3); margin-top: 0.4em; }
.cf-full-post-content strong { color: var(--pr-text); }
.more-posts { color: var(--pr-text) !important; }

/* ---------- footer ---------- */
.footer { border-top: 3px solid var(--pr-line); }
.footer-text-header { color: var(--pr-text) !important; font-size: 1.5rem; }
.footer-text-header:after, .widget-header-txt:after { background-color: var(--pr-teal) !important; }
.pr-theme-row { padding-top: 6px; padding-bottom: 22px; }
.pr-theme-toggle {
  appearance: none;
  border: 0;
  padding: 8px 14px;
  background: var(--pr-raised);
  color: var(--pr-text);
  font: 600 0.98rem var(--pr-display);
  letter-spacing: 0.04em;
  cursor: pointer;
}
.pr-theme-toggle:hover { background: var(--pr-line); }

/* ---------- forms + misc that Cobalt leaves to Bootstrap ---------- */
.form-control, .form-control:focus { color: var(--pr-text); }
.form-control::placeholder { color: var(--pr-text-3); opacity: 1; }
.table, .table td, .table th { color: var(--pr-text-2); border-color: var(--pr-line); }
.alert-info { background: var(--pr-surface-2); border-color: var(--pr-teal); color: var(--pr-text); }
hr { border-color: var(--pr-line); }
.line-scale > div { background-color: var(--pr-amber) !important; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation-duration: 0.01ms !important; }
}

/* Reserve the width of the painted logo so the status/Discord boxes sit beside it, not on it.
   Painted logo = 41% of the art's width; the art is "cover" in a 540px (270px mobile) hero. */
@media (min-width: 769px) { .logo-container .logo { width: max(44vw, 420px); object-fit: contain; } }
@media (max-width: 768px) { .logo-container .logo { width: max(46vw, 215px); object-fit: contain; } }

/* Small phones: lift the painted logo clear of the welcome card that overlaps the hero's foot. */
@media (max-width: 520px) {
  html .header, html.webp .header, html.no-webp .header {
    background-size: auto 114% !important;
    background-position: center bottom !important;
  }
}

/* The mobile menu button sits on the key art in both schemes. */
.navbar-top-new .navbar-toggler, .navbar-top-new .navbar-toggler i {
  color: var(--pr-hero-ink) !important;
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.9), 0 0 10px rgba(0, 0, 0, 0.7);
}

/* ---------- contrast fixes (measured: all body text >= 4.5:1 in both schemes) ---------- */
html .nav-header-text, html .header-theme, html .lr-title, html .theme-text,
html .card-header.header-theme { color: var(--pr-link) !important; }
.footer, .footer p, .footer .footer-link, .f-top-copy { color: var(--pr-text-2) !important; opacity: 1 !important; }
.footer .footer-link:hover { color: var(--pr-link) !important; }
.f-bottom-copy { color: var(--pr-text-3) !important; opacity: 1 !important; }
code { color: var(--pr-text); background: var(--pr-raised); padding: 0.1em 0.35em; border-radius: 0; }
