/* Wulfinn Nordic layer — Norse lettering, runes, knotwork and Vinland Saga flavour across the whole site.
 * Theme-independent (theme --color-* variables only); loaded from custom/header.tmpl after wulfinn-fx.css.
 * Motifs are SVG masks tinted with the active theme's colors. Fonts are self-hosted, OFL-1.1. */

@font-face { font-family: "Wulfinn Norse"; src: url("../fonts/germania-one-latin-400-normal.woff2") format("woff2"); font-display: swap; }
@font-face { font-family: "Wulfinn Serif"; src: url("../fonts/cinzel-latin-700-normal.woff2") format("woff2"); font-weight: 700; font-display: swap; }
/* runic block only — every other character falls through to the normal UI font */
@font-face { font-family: "Wulfinn Runic"; src: url("../fonts/noto-sans-runic-runic-400-normal.woff2") format("woff2"); unicode-range: U+16A0-16FF; font-display: swap; }

:root {
  --fonts-override: "Wulfinn Runic", -apple-system, "Segoe UI", system-ui, "Noto Sans", "Noto Sans Hebrew", Roboto, "Helvetica Neue", Arial;
  --fonts-monospace: "Wulfinn Runic", ui-monospace, SFMono-Regular, "SF Mono", Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace, var(--fonts-emoji);
  --wn-display: "Wulfinn Norse", "Wulfinn Runic", Georgia, serif;
  --wn-serif: "Wulfinn Serif", "Wulfinn Runic", Georgia, serif;
  --wn-accent: var(--color-primary);
  --wn-knot: url("../img/nordic/knot.svg");
  --wn-valknut: url("../img/nordic/valknut.svg");
  --wn-axes: url("../img/nordic/axes.svg");
  --wn-dagger: url("../img/nordic/dagger.svg");
  --wn-vegvisir: url("../img/nordic/vegvisir.svg");
}

/* tinted motif helper: <span class="wn-ico" style="--wn-m: var(--wn-axes)"></span> */
.wn-ico {
  display: inline-block;
  width: 1em;
  height: 1em;
  background: currentcolor;
  -webkit-mask: var(--wn-m) center / contain no-repeat;
  mask: var(--wn-m) center / contain no-repeat;
  vertical-align: -0.12em;
}

/* =========================================================================
   Navbar: wordmark next to the longship
   ========================================================================= */
#navbar-logo { gap: 8px; }
#navbar-logo::after {
  content: "Wulfinn";
  display: inline-block;
  position: static;
  font: 22px/1 var(--wn-display);
  letter-spacing: 0.04em;
  color: var(--color-text);
  transform: none;
  background: none;
  height: auto;
  inset: auto;
}
#navbar-logo:hover::after { color: var(--wn-accent); }
@media (max-width: 767.98px) { #navbar-logo::after { display: none; } }

/* =========================================================================
   Lettering — every heading uses the Norse display face.
   Excluded: file headers (filenames keep their exact text) and anything inside code/terminals.
   ========================================================================= */
h1, h2, h3, h4, h5, h6,
.ui.header:is(h1, h2, h3, h4, h5, h6),
.repo-header .flex-item-title,
.profile-avatar-name .header,
.wn-panel-title, .wn-form-head h2, .wn-lost h2, .wn-quote p {
  font-family: var(--wn-display) !important;
  font-weight: 400 !important;
  letter-spacing: 0.025em;
}
:is(h1, h2, h3, h4, h5, h6).ui.header.file-header,
:is(h1, h2, h3, h4, h5, h6).file-header,
:is(pre, code, .wh-term) :is(h1, h2, h3, h4, h5, h6) {
  font-family: var(--fonts-regular) !important;
  font-weight: 600 !important;
  letter-spacing: normal;
}
.repo-header .flex-item-title { font-size: 26px; line-height: 1.2; }
.repo-header .flex-item-title a.tw-font-semibold { font-weight: 400 !important; color: var(--color-text); }
.profile-avatar-name .header { font-size: 28px !important; line-height: 1.15 !important; }

/* box headers get a rune bullet (not file headers / space-between flex headers, where it would float alone) */
h4.ui.top.attached.header:not(.file-header, .tw-justify-between)::before {
  content: "ᛟ";
  font-family: "Wulfinn Runic", sans-serif;
  color: var(--wn-accent);
  margin-inline-end: 0.5em;
  opacity: 0.85;
}

/* =========================================================================
   Avatars: round shields with a boss ring
   ========================================================================= */
img.avatar { border-radius: 50% !important; box-shadow: 0 0 0 1.5px var(--color-body), 0 0 0 2.5px color-mix(in srgb, var(--wn-accent) 45%, transparent); }
a:hover > img.avatar, a.avatar:hover img, img.avatar:hover { box-shadow: 0 0 0 1.5px var(--color-body), 0 0 0 3px var(--wn-accent); }

/* =========================================================================
   Knotwork bands
   ========================================================================= */
.secondary-nav { position: relative; }
.secondary-nav::after,
.page-footer::before,
.wn-knot-band {
  content: "";
  display: block;
  height: 10px;
  background: color-mix(in srgb, var(--wn-accent) 55%, transparent);
  -webkit-mask: var(--wn-knot) 0 50% / 24px 10px repeat-x;
  mask: var(--wn-knot) 0 50% / 24px 10px repeat-x;
  pointer-events: none;
}
/* bands sit in their own space (never on top of borders or the active-tab underline) */
.secondary-nav { margin-bottom: 18px !important; }
.secondary-nav::after { position: absolute; left: 0; right: 0; top: calc(100% + 4px); opacity: 0.55; }
.page-footer { position: relative; }
.page-footer { padding-top: 18px !important; }
.page-footer::before { position: absolute; left: 0; right: 0; top: 4px; opacity: 0.5; }

/* saga line injected into the footer by wulfinn-nordic.js */
.wn-saga-line {
  flex: 1 1 100%;
  order: -1;
  text-align: center;
  font: 13px var(--wn-serif);
  letter-spacing: 0.04em;
  color: var(--color-text-light-2);
  padding: 4px 0 10px;
  transition: opacity 0.4s ease;
}
.wn-saga-line .wn-runes { font-family: "Wulfinn Runic", sans-serif; color: var(--wn-accent); opacity: 0.7; margin: 0 0.6em; letter-spacing: 0.2em; }
.wn-saga-line cite { font-style: normal; color: var(--color-text-light-3); margin-inline-start: 0.5em; }
.page-footer { flex-wrap: wrap; }

/* =========================================================================
   Empty states get a valknut
   ========================================================================= */
.empty-placeholder::before {
  content: "";
  display: block;
  width: 56px;
  height: 56px;
  margin: 0 auto 8px;
  background: color-mix(in srgb, var(--wn-accent) 60%, transparent);
  -webkit-mask: var(--wn-valknut) center / contain no-repeat;
  mask: var(--wn-valknut) center / contain no-repeat;
}

/* =========================================================================
   Auth pages (sign in / register) — templates/user/auth/{signin,signup}.tmpl
   ========================================================================= */
.page-content.wn-auth { padding-top: 0 !important; margin-top: 0 !important; }
.wn-auth {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
  min-height: calc(100vh - 56px - 64px);
  padding: 0 !important;
}
.wn-panel {
  position: relative;
  overflow: hidden;
  isolation: isolate;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 18px;
  padding: 56px 40px 120px;
  text-align: center;
  color: var(--color-console-fg);
  background: var(--color-console-bg);
}
/* flat fjord: moon, two mountain ranges, sea */
.wn-moon {
  position: absolute;
  top: 48px;
  right: 14%;
  width: 54px;
  height: 54px;
  border-radius: 50%;
  background: color-mix(in srgb, var(--color-console-fg) 85%, var(--wn-accent));
  box-shadow: inset -12px -4px 0 0 color-mix(in srgb, var(--color-console-fg) 60%, var(--color-console-bg));
  z-index: -1;
}
.wn-fjord, .wn-fjord::after {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 40px;
  height: 160px;
  z-index: -1;
  pointer-events: none;
  background: color-mix(in srgb, var(--wn-accent) 14%, var(--color-console-bg));
  -webkit-mask: url("../img/nordic/fjord.svg") 0 100% / 100% 100% no-repeat;
  mask: url("../img/nordic/fjord.svg") 0 100% / 100% 100% no-repeat;
}
.wn-fjord::after {
  content: "";
  bottom: -40px;
  height: 120px;
  background: color-mix(in srgb, var(--wn-accent) 24%, var(--color-console-bg));
  -webkit-mask-image: url("../img/nordic/fjord2.svg");
  mask-image: url("../img/nordic/fjord2.svg");
}
.wn-stars {
  position: absolute;
  inset: 0 0 50% 0;
  z-index: -1;
  pointer-events: none;
  background-image:
    radial-gradient(1.5px 1.5px at 12% 18%, var(--color-console-fg) 50%, transparent 51%),
    radial-gradient(1.5px 1.5px at 72% 12%, var(--color-console-fg) 50%, transparent 51%),
    radial-gradient(2px 2px at 38% 32%, var(--color-console-fg) 50%, transparent 51%),
    radial-gradient(1.5px 1.5px at 86% 40%, var(--color-console-fg) 50%, transparent 51%),
    radial-gradient(1.5px 1.5px at 22% 62%, var(--color-console-fg) 50%, transparent 51%),
    radial-gradient(1.5px 1.5px at 58% 8%, var(--color-console-fg) 50%, transparent 51%);
  opacity: 0.5;
  animation: wn-twinkle 3s steps(2) infinite alternate;
}
/* sea at the bottom of the panel */
.wn-sea, .wn-sea::after {
  position: absolute;
  left: -120px;
  right: -120px;
  bottom: -2px;
  height: 52px;
  z-index: -1;
  pointer-events: none;
  background: color-mix(in srgb, var(--wn-accent) 34%, var(--color-console-bg));
  -webkit-mask: url("../img/nordic/wave.svg") 0 0 / 120px 100% repeat-x;
  mask: url("../img/nordic/wave.svg") 0 0 / 120px 100% repeat-x;
  animation: wn-swell 6s linear infinite;
}
.wn-sea::after { content: ""; left: 0; right: 0; bottom: -18px; background: color-mix(in srgb, var(--wn-accent) 48%, var(--color-console-bg)); animation-duration: 4s; animation-direction: reverse; }
.wn-panel-ship {
  position: absolute;
  bottom: 34px;
  left: -90px;
  width: 70px;
  height: 44px;
  z-index: -1;
  background: var(--color-console-fg);
  -webkit-mask: url("../img/nordic/longship.svg") center / contain no-repeat;
  mask: url("../img/nordic/longship.svg") center / contain no-repeat;
  animation: wn-sail 26s linear infinite;
}
.wn-seal { position: relative; width: 210px; height: 210px; display: grid; place-items: center; }
.wn-seal img { width: 140px; height: 140px; animation: wn-bob 5s ease-in-out infinite; }
.wn-ring { position: absolute; inset: 0; animation: wn-turn 60s linear infinite; }
.wn-ring text { font: 15px "Wulfinn Runic", sans-serif; fill: color-mix(in srgb, var(--wn-accent) 80%, var(--color-console-fg)); letter-spacing: 3px; }
.wn-seal:hover .wn-ring { animation-duration: 8s; }
.wn-panel-title { font: clamp(34px, 4vw, 54px)/1 var(--wn-display); margin: 0; color: var(--color-console-fg); letter-spacing: 0.03em; }
.wn-panel-title em { font-style: normal; color: var(--wn-accent); }
.wn-panel-runes { font: 14px "Wulfinn Runic", sans-serif; letter-spacing: 0.35em; color: var(--wn-accent); opacity: 0.8; margin: -8px 0 0; }
.wn-quote { max-width: 460px; margin: 6px 0 0; min-height: 86px; transition: opacity 0.35s ease, transform 0.35s ease; }
.wn-quote.swap { opacity: 0; transform: translateY(6px); }
.wn-quote p { font: 22px/1.35 var(--wn-display); margin: 0 0 6px; color: var(--color-console-fg); }
.wn-quote cite { font: 12px var(--fonts-monospace); color: var(--color-console-fg-subtle); font-style: normal; letter-spacing: 0.05em; }
.wn-crew { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 4px; }
.wn-crew button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid color-mix(in srgb, var(--color-console-fg) 18%, transparent);
  background: color-mix(in srgb, var(--color-console-fg) 5%, transparent);
  color: var(--color-console-fg);
  font: 600 12px var(--wn-serif);
  letter-spacing: 0.04em;
  cursor: pointer;
  transition: border-color 0.18s ease, background-color 0.18s ease, transform 0.18s cubic-bezier(0.16, 1, 0.3, 1);
}
.wn-crew button:hover, .wn-crew button.on { border-color: var(--wn-accent); background: color-mix(in srgb, var(--wn-accent) 16%, transparent); transform: translateY(-2px); }
.wn-crew .wn-ico { color: var(--wn-accent); }

.wn-form {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 48px clamp(20px, 5vw, 64px);
  gap: 16px;
}
.wn-form-head { text-align: center; margin-bottom: 4px; }
.wn-form-head h2 { font: 30px/1.1 var(--wn-display); margin: 0 0 6px; color: var(--color-text); letter-spacing: 0.03em; }
.wn-form-head p { margin: 0; color: var(--color-text-light-2); }
.wn-form-head .wn-knot-band { width: 140px; margin: 12px auto 0; opacity: 0.7; }
.wn-form > .ui.container { width: 100% !important; max-width: 440px; margin: 0 auto !important; }
.wn-form .ui.top.attached.header { text-align: center; }
.wn-form .ui.attached.segment { padding: 22px; }
.wn-form .ui.primary.button { font-family: var(--wn-display); font-weight: 400; font-size: 17px; letter-spacing: 0.06em; padding-block: 12px; }

@media (max-width: 900px) {
  .wn-auth { grid-template-columns: 1fr; }
  .wn-panel { padding: 36px 20px 64px; gap: 12px; }
  .wn-seal { width: 150px; height: 150px; }
  .wn-seal img { width: 100px; height: 100px; }
  .wn-crew { display: none; }
}

/* =========================================================================
   404 / 500 — templates/status/404.tmpl
   ========================================================================= */
.wn-lost { text-align: center; padding: 72px 16px 40px; position: relative; }
.wn-lost .wn-compass { width: 120px; height: 120px; margin: 0 auto 16px; color: var(--wn-accent); --wn-m: var(--wn-vegvisir); animation: wn-lost-spin 9s cubic-bezier(0.6, 0, 0.4, 1) infinite; }
.wn-lost .wn-compass.wn-ico { display: block; }
.wn-lost h1 { font: clamp(64px, 12vw, 140px)/1 var(--wn-display); margin: 0; color: var(--color-text); letter-spacing: 0.04em; }
.wn-lost h2 { font: 28px var(--wn-display); margin: 6px 0 10px; color: var(--color-text); letter-spacing: 0.03em; }
.wn-lost p { color: var(--color-text-light-2); max-width: 520px; margin: 0 auto 18px; }
.wn-lost .wn-runes { font-family: "Wulfinn Runic", sans-serif; color: var(--wn-accent); letter-spacing: 0.4em; opacity: 0.7; }

/* =========================================================================
   Keyframes
   ========================================================================= */
@keyframes wn-twinkle { from { opacity: 0.35; } to { opacity: 0.75; } }
@keyframes wn-swell { to { transform: translateX(120px); } }
@keyframes wn-sail { 0% { transform: translate(0, 0) rotate(-2deg); } 50% { transform: translate(calc(50vw + 60px), -3px) rotate(2deg); } 100% { transform: translate(calc(100vw + 180px), 0) rotate(-2deg); } }
@keyframes wn-bob { 50% { transform: translateY(-6px) rotate(1.5deg); } }
@keyframes wn-turn { to { transform: rotate(360deg); } }
@keyframes wn-lost-spin { 0% { transform: rotate(0); } 30% { transform: rotate(200deg); } 45% { transform: rotate(170deg); } 70% { transform: rotate(400deg); } 100% { transform: rotate(360deg); } }

@media (prefers-reduced-motion: reduce) {
  .wn-panel-ship, .wn-stars, .wn-sea, .wn-seal img, .wn-ring, .wn-lost .wn-compass { animation: none !important; }
}
