/* Wulfinn eye candy — flat, clean, a little unhinged. Theme-independent (theme --color-* only).
 * Every animated thing here is a small leaf element (ship, pop, badge), never a container. */

:root {
  --wc-accent: var(--color-primary);
  --wc-ink: color-mix(in srgb, var(--color-text) 55%, var(--color-nav-bg));
  --wc-ease: cubic-bezier(0.2, 0.9, 0.3, 1);
}

/* =========================================================================
   Carved rune names + sailing banner ship
   ========================================================================= */
.ws-carved {
  font: 13px/1.4 "Wulfinn Runic", sans-serif;
  letter-spacing: 0.32em;
  color: var(--wc-accent);
  opacity: 0.75;
  margin-top: 2px;
  user-select: all;
  cursor: help;
}
.ws-carved:hover { opacity: 1; }
.repo-header .ws-carved { margin-left: 2px; }
.ws-banner-lane { position: absolute; left: 0; right: 0; bottom: 0; height: 34px; overflow: hidden; pointer-events: none; border-radius: 0 0 18px 18px; }
.ws-banner-ship {
  position: absolute;
  left: -70px;
  bottom: 4px;
  width: 44px;
  height: 28px;
  pointer-events: none;
  background: var(--wc-accent);
  opacity: 0.22;
  -webkit-mask: url("../img/nordic/longship.svg") center / contain no-repeat;
  mask: url("../img/nordic/longship.svg") center / contain no-repeat;
  animation: wc-sail 48s linear infinite;
}

/* =========================================================================
   Action pops (Skál!)
   ========================================================================= */
.ws-pop {
  position: fixed;
  z-index: 10001;
  pointer-events: none;
  padding: 6px 14px;
  border-radius: 999px;
  background: var(--wc-accent);
  color: var(--color-primary-contrast);
  font: 17px/1.2 var(--wn-display, serif);
  letter-spacing: 0.03em;
  white-space: nowrap;
  transform: translate(-50%, -50%);
  animation: wc-pop 1.1s var(--wc-ease) forwards;
}

/* =========================================================================
   Dashboard — greeting, heatmap as shield bosses, raid log
   ========================================================================= */
.ws-greet {
  position: relative;
  display: flex;
  align-items: stretch;
  gap: 16px;
  margin-bottom: 14px;
  padding: 18px 20px;
  border-radius: 16px;
  background: var(--wc-accent);
  color: var(--color-primary-contrast);
  overflow: hidden;
}
.ws-greet h2 { margin: 0 0 4px; font-size: 28px; color: inherit; }
.ws-greet p { margin: 0; }
.ws-greet-day { font-size: 15px; opacity: 0.95; }
.ws-greet-norse { margin-top: 6px !important; font-size: 12px; opacity: 0.7; }
.ws-greet-runes { font: 13px "Wulfinn Runic", sans-serif; letter-spacing: 0.3em; cursor: help; }
.ws-greet-text { position: relative; z-index: 1; flex: 1; }
.ws-greet-sea {
  position: absolute;
  left: 0;
  right: 0;
  bottom: -2px;
  height: 22px;
  pointer-events: none;
  background: color-mix(in srgb, var(--color-primary-contrast) 16%, transparent);
  -webkit-mask: url("../img/nordic/wave.svg") 0 0 / 80px 100% repeat-x;
  mask: url("../img/nordic/wave.svg") 0 0 / 80px 100% repeat-x;
}
.ws-greet-ship {
  position: absolute;
  bottom: 10px;
  left: -60px;
  width: 40px;
  height: 26px;
  background: var(--color-primary-contrast);
  opacity: 0.7;
  -webkit-mask: url("../img/nordic/longship.svg") center / contain no-repeat;
  mask: url("../img/nordic/longship.svg") center / contain no-repeat;
  animation: wc-sail 30s linear infinite;
}

/* heatmap cells become little round shields; hover lifts them */
#user-heatmap .vch__day__square { rx: 50%; ry: 50%; transition: stroke-width 0.12s ease; }
#user-heatmap .vch__day__square:hover { stroke: var(--color-text); stroke-width: 1.5px; }
#user-heatmap .vch__legend__wrapper rect { rx: 50%; ry: 50%; }
#user-heatmap .total-contributions { font-family: var(--wn-display, serif); font-size: 17px; letter-spacing: 0.03em; }

.ws-raidlog { display: flex; flex-direction: column; gap: 12px; margin: 4px 0 18px; }
.ws-rank {
  display: grid;
  grid-template-columns: auto 1fr minmax(180px, 34%);
  align-items: center;
  gap: 16px;
  padding: 14px 18px;
  border-radius: 16px;
  border: 1px solid var(--color-secondary);
  background: var(--color-box-body);
}
.ws-rank-badge {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--wc-accent);
  color: var(--color-primary-contrast);
  font-size: 28px;
  animation: wc-spin-slow 24s linear infinite;
}
.ws-rank-label { font-size: 11px; text-transform: uppercase; letter-spacing: 0.14em; color: var(--color-text-light-3); }
.ws-rank-name { font: 30px/1.05 var(--wn-display, serif); letter-spacing: 0.03em; color: var(--color-text); }
.ws-rank-motto { color: var(--color-text-light-2); font-size: 13px; }
.ws-rank-meaning { font: 15px var(--fonts-regular); letter-spacing: 0; color: var(--color-text-light-2); }
.ws-help {
  position: relative;
  display: inline-grid;
  place-items: center;
  width: 15px;
  height: 15px;
  margin-left: 4px;
  border-radius: 50%;
  border: 1px solid var(--color-secondary-dark-2);
  font-size: 10px;
  letter-spacing: 0;
  cursor: help;
  vertical-align: 1px;
}
.ws-help-tip {
  position: absolute;
  left: 50%;
  top: calc(100% + 8px);
  width: 320px;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--color-text);
  color: var(--color-body);
  font-size: 12px;
  line-height: 1.45;
  text-transform: none;
  letter-spacing: 0;
  z-index: 50;
  pointer-events: none;
  opacity: 0;
  transform: translate(-50%, -4px);
  transition: opacity 0.15s ease, transform 0.2s var(--wc-ease);
}
.ws-help:hover .ws-help-tip, .ws-help:focus .ws-help-tip { opacity: 1; transform: translate(-50%, 0); }
.ws-rank-bar { height: 10px; border-radius: 999px; background: var(--color-secondary); overflow: hidden; }
.ws-rank-bar i { display: block; height: 100%; width: 0; border-radius: inherit; background: var(--wc-accent); transition: width 1.2s var(--wc-ease); }
.ws-rank-next small { display: block; margin-top: 6px; color: var(--color-text-light-2); text-align: right; }
.ws-stats { display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; }
.ws-stat {
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid var(--color-secondary);
  background: var(--color-box-body);
  transition: border-color 0.15s ease;
}
.ws-stat:hover { border-color: var(--wc-accent); }
.ws-stat b { display: block; font: 30px/1.1 var(--wn-display, serif); color: var(--wc-accent); font-variant-numeric: tabular-nums; }
.ws-stat span { font-size: 12px; color: var(--color-text-light-2); }
@media (max-width: 900px) { .ws-stats { grid-template-columns: repeat(2, 1fr); } .ws-rank { grid-template-columns: auto 1fr; } .ws-rank-next { grid-column: 1 / -1; } }

/* =========================================================================
   Konami longship
   ========================================================================= */
.ws-konami-ship {
  position: fixed;
  z-index: 10000;
  top: 30vh;
  left: -200px;
  width: 180px;
  height: 112px;
  pointer-events: none;
  background: var(--wc-accent);
  -webkit-mask: url("../img/nordic/longship.svg") center / contain no-repeat;
  mask: url("../img/nordic/longship.svg") center / contain no-repeat;
  animation: wc-fly 3.4s cubic-bezier(0.45, 0, 0.55, 1) forwards;
}

/* =========================================================================
   Keyframes
   ========================================================================= */
@keyframes wc-hop { 40% { transform: translateY(-7px); } 70% { transform: translateY(0); } }
@keyframes wc-sail { 0% { transform: translateX(0) rotate(-2deg); } 50% { transform: translateX(calc(50vw + 40px)) rotate(2deg); } 100% { transform: translateX(calc(100vw + 140px)) rotate(-2deg); } }
@keyframes wc-pop { 0% { opacity: 0; transform: translate(-50%, -50%) scale(0.6); } 18% { opacity: 1; transform: translate(-50%, -90%) scale(1.06); } 30% { transform: translate(-50%, -100%) scale(1); } 80% { opacity: 1; } 100% { opacity: 0; transform: translate(-50%, -190%); } }
@keyframes wc-spin-slow { to { transform: rotate(360deg); } }
@keyframes wc-fly { 0% { transform: translate(0, 0) rotate(-4deg); } 50% { transform: translate(60vw, -30px) rotate(4deg); } 100% { transform: translate(calc(100vw + 400px), 0) rotate(-3deg); } }

@media (prefers-reduced-motion: reduce) {
  .ws-banner-ship, .ws-greet-ship, .ws-rank-badge, .ws-konami-ship { animation: none !important; }
  .ws-banner-ship, .ws-greet-ship { display: none; }
}

/* =========================================================================
   Form controls, site-wide — checkbox = rune tile, radio = shield, toggle = shield knob.
   Inputs are leaf elements, so transforms here are safe.
   ========================================================================= */
:root {
  --checkbox-size: 18px;
  --wc-check: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><path d="M3 8.6 L6.6 12.2 L13.2 4.2" fill="none" stroke="black" stroke-width="2.8" stroke-linecap="square" stroke-linejoin="miter"/></svg>');
  --wc-dash: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><path d="M3.5 8 H12.5" stroke="black" stroke-width="2.8" stroke-linecap="square"/></svg>');
}

/* ---- checkbox: rune tile ---- */
input[type="checkbox"]:not(.ui.toggle.checkbox input) {
  appearance: none;
  -webkit-appearance: none;
  position: relative;
  flex-shrink: 0;
  width: var(--checkbox-size) !important;
  height: var(--checkbox-size) !important;
  margin-block-start: 0 !important;
  border: 2px solid var(--color-secondary-dark-4) !important;
  border-radius: 5px !important;
  background: var(--color-input-background) !important;
  cursor: pointer;
  vertical-align: -3px;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}
input[type="checkbox"]:not(.ui.toggle.checkbox input):not([disabled]):hover { border-color: var(--wc-accent) !important; }
input[type="checkbox"]:not(.ui.toggle.checkbox input):checked,
input[type="checkbox"]:not(.ui.toggle.checkbox input):indeterminate {
  border-color: var(--wc-accent) !important;
  background: var(--wc-accent) !important;
  animation: wc-stamp 0.32s var(--wc-ease);
}
input[type="checkbox"]:not(.ui.toggle.checkbox input)::after {
  content: "";
  position: absolute;
  inset: -2px;
  pointer-events: none;
  background: var(--color-primary-contrast) !important;
  -webkit-mask: var(--wc-check) center / 100% no-repeat;
  mask: var(--wc-check) center / 100% no-repeat;
  clip-path: inset(0 100% 0 0);
  transition: clip-path 0.22s var(--wc-ease) 0.05s;
}
input[type="checkbox"]:not(.ui.toggle.checkbox input):checked::after { clip-path: inset(0 0 0 0); }
input[type="checkbox"]:not(.ui.toggle.checkbox input):indeterminate::after { clip-path: inset(0 0 0 0); -webkit-mask-image: var(--wc-dash); mask-image: var(--wc-dash); }

/* inside Fomantic .ui.checkbox wrappers the input is absolutely placed beside its label — keep that */
.ui.checkbox input[type="checkbox"]:not(.ui.toggle.checkbox input),
.ui.checkbox input[type="radio"]:not(.ui.toggle.checkbox input) {
  position: absolute !important;
  top: 0;
  inset-inline-start: 0;
}

/* ---- radio: round shield with a boss ---- */
input[type="radio"]:not(.ui.toggle.checkbox input) {
  appearance: none;
  -webkit-appearance: none;
  position: relative;
  flex-shrink: 0;
  width: var(--checkbox-size) !important;
  height: var(--checkbox-size) !important;
  margin-block-start: 0 !important;
  border: 2px solid var(--color-secondary-dark-4);
  border-radius: 50%;
  background: var(--color-input-background);
  cursor: pointer;
  vertical-align: -3px;
  transition: border-color 0.15s ease, box-shadow 0.22s var(--wc-ease);
}
input[type="radio"]:not(.ui.toggle.checkbox input):not([disabled]):hover { border-color: var(--wc-accent); }
input[type="radio"]:not(.ui.toggle.checkbox input):checked {
  border-color: var(--wc-accent);
  box-shadow: inset 0 0 0 2px var(--color-input-background), inset 0 0 0 9px var(--wc-accent);
  animation: wc-stamp 0.32s var(--wc-ease);
}
/* the boss rivet in the middle of the shield */
input[type="radio"]:not(.ui.toggle.checkbox input)::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 4px;
  height: 4px;
  margin: -2px 0 0 -2px;
  border-radius: 50%;
  background: var(--color-primary-contrast);
  transform: scale(0);
  transition: transform 0.2s var(--wc-ease) 0.06s;
}
input[type="radio"]:not(.ui.toggle.checkbox input):checked::after { transform: scale(1); }

input[type="checkbox"]:not(.ui.toggle.checkbox input):focus-visible,
input[type="radio"]:not(.ui.toggle.checkbox input):focus-visible { outline: 2px solid var(--wc-accent); outline-offset: 2px; }
input[type="checkbox"][disabled]:not(.ui.toggle.checkbox input),
input[type="radio"][disabled]:not(.ui.toggle.checkbox input) { cursor: not-allowed; opacity: 0.55; }
/* read-only task lists in rendered markdown keep full colour when ticked */
.markup input[type="checkbox"][disabled]:checked { opacity: 1; }

/* ---- toggle: a shield knob carrying a rune, sliding along a flat track ---- */
.ui.toggle.checkbox label::before {
  border: 2px solid var(--color-secondary-dark-4) !important;
  background: var(--color-input-toggle-background) !important;
  box-shadow: none !important;
  transition: background-color 0.18s ease, border-color 0.18s ease;
}
.ui.toggle.checkbox input:checked ~ label::before {
  border-color: var(--wc-accent) !important;
  background: var(--wc-accent) !important;
}
.ui.toggle.checkbox label::after {
  content: "ᛟ" !important;
  display: grid !important;
  place-items: center;
  font: 11px/1 "Wulfinn Runic", sans-serif !important;
  color: var(--color-secondary-dark-6) !important;
  background: var(--color-body) !important;
  border: 2px solid var(--color-secondary-dark-4) !important;
  box-shadow: none !important;
  transition: left 0.25s var(--wc-ease), transform 0.4s var(--wc-ease), color 0.18s ease, border-color 0.18s ease !important;
}
.ui.toggle.checkbox input:checked ~ label::after {
  color: var(--wc-accent) !important;
  border-color: var(--wc-accent) !important;
  transform: rotate(360deg);
}

@keyframes wc-stamp { 0% { transform: scale(0.7); } 60% { transform: scale(1.15); } 100% { transform: scale(1); } }
@media (prefers-reduced-motion: reduce) {
  input[type="checkbox"], input[type="radio"], .ui.toggle.checkbox label::after { animation: none !important; transition: none !important; }
}
