/* =============================
   Fonts
============================= */
@font-face {
  font-family: 'Swiss721';
  src: url('./fonts/Swiss721ExtendedBold.ttf') format('truetype');
}
@font-face {
  font-family: "FSSinclair";
  src: url('./fonts/FSSinclair-Regular.otf') format('opentype');
  font-weight: 500;
  font-style: normal;
}
@font-face {
  font-family: "FSSinclair";
  src: url('./fonts/FSSinclair-Light.otf') format('opentype');
  font-weight: 200;
  font-style: normal;
}
@font-face {
  font-family: "Kanit";
  src: url('./fonts/Kanit-Regular.ttf') format('truetype');
  font-weight: 400;
  font-style: normal;
}
@font-face {
  font-family: "Kanit";
  src: url('./fonts/Kanit-Thin.ttf') format('truetype');
  font-weight: 100;
  font-style: normal;
}
@font-face {
  font-family: "Kanit";
  src: url('./fonts/Kanit-ExtraLight.ttf') format('truetype');
  font-weight: 200;
  font-style: normal;
}
@font-face {
  font-family: "Kanit";
  src: url("./fonts/Kanit-Italic.ttf") format("truetype");
  font-weight: 400;
  font-style: italic;
}
@font-face {
  font-family: "Kanit";
  src: url("./fonts/Kanit-Bold.ttf") format("truetype");
  font-weight: 700;
  font-style: normal;
}
@font-face {
  font-family: "Kanit";
  src: url("./fonts/Kanit-BoldItalic.ttf") format("truetype");
  font-weight: 700;
  font-style: italic;
}

/* =============================
   Base
============================= */
* { box-sizing: border-box; }

body {
  background: #1d1d1e;
  color: #fff;
  font-family: 'Kanit', 'FSSinclair', sans-serif;
  font-weight: 200;
  padding: 1rem;
  font-size: 1rem;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
}

strong { font-weight: 500; }

h1 {
  font-family: 'Swiss721', sans-serif;
  color: #FFE710;
  text-transform: uppercase;
}
h2 {
  font-family: 'FSSinclair', sans-serif;
  font-weight: 500;
  color: #fff;
  margin: 0 0 1rem;
}
.second { color: #fff; }
p { margin-bottom: 0; }

hr {
  border: none;
  border-top: 3px double #FFE710;
  color: #fce650;
  overflow: visible;
  text-align: center;
  height: 5px;
  width: 100%;
  margin: 2rem 0;
}
hr::after {
  content: '';
  display: inline-block;
  width: 25px;
  height: 25px;
  background-image: url('./helldivers.png');
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
  padding: 0 4px;
  position: relative;
  top: -12px;
}

.container { max-width: 860px; }

/* =============================
   Controls
============================= */
.rack-controls {
  margin: 0 0 1rem;
  display: grid;
  gap: .5rem;
  justify-content: center;
}
label {
  font-family: "Swiss721", sans-serif;
  font-size: .8em;
  text-transform: uppercase;
  color: #FFF;
}

/* Buttons */
.buttons {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  margin-top: 1rem;
}
.primary,
input[type="file"]::file-selector-button {
  border: 1px solid #FFE710;
  background: #FFE710;
  color: #000;
  font-family: "Kanit", "FSSinclair", sans-serif;
  font-weight: 400;
  font-size: 0.8rem;
  text-transform: uppercase;
  margin-right: 5px;
  cursor: pointer;
}
.primary:hover,
input[type="file"]::file-selector-button:hover {
  border: 1px solid #7ACDFF;
  background: #7ACDFF;
  color: #0e0e10;
}
.primary:active,
input[type="file"]::file-selector-button:active {
  border: 1px solid #7ACDFF;
  background: #7ACDFF;
  color: #0e0e10;
}
.secondary {
  border: 1px solid #FFE710;
  background: transparent;
  font-family: "Kanit", "FSSinclair", sans-serif;
  font-weight: 400;
  text-transform: uppercase;
  margin-right: 5px;
  color: #fff;
  cursor: pointer;
}
.secondary:hover {
  border: 1px solid #FFE710;
  background: #FFE710;
  color: #0e0e10;
}
.secondary:active {
  border: 1px solid #FFE710;
  background: #FFE710;
  color: #0e0e10;
}

/* Inputs */
input[type="file"],
input[type="text"] {
  font-family: "FSSinclair", sans-serif;
  font-weight: 400;
  font-size: 1rem;
  color: #fff;
  border: 0;
  border-left: 3px solid rgb(51, 60, 66);
  background: rgb(9, 26, 33);
  padding-left: 5px;
}
input[type="file"] {
  margin-bottom: 6px;
  width: 50%;
  display: block;
}
input[type="file" i]:disabled,
input[type="file" i]:disabled:hover {
  background: transparent;
  border: transparent;
}
input[type="file" i]:disabled::file-selector-button,
input[type="file" i]:disabled::file-selector-button:hover {
  background: repeating-linear-gradient(45deg, #3d3e39, #3d3e39 3px, transparent 3px, transparent 5px);
  color: gray;
  border: transparent;
}

/* New input highlight */
.highlight-new { border: 2px solid #fce650; animation: fadeBorder 3s ease-out forwards; }
@keyframes fadeBorder { 0% { border-color: #fce650; } 100% { border-color: transparent; } }

/* Two-up fields */
.two-up {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px 16px;
  width: 100%;
  max-width: 720px;
}
.two-up .field { display: flex; flex-direction: column; gap: 6px; }
.two-up .field input[type="text"] { width: 100%; }

@media (max-width: 640px) {
  .two-up { grid-template-columns: 1fr; }
}

/* =============================
   Badge Rack
============================= */
.badge-rack {
  flex: 1;
  max-width: 460px;
  min-width: 380px;
  display: grid;
  grid-template-columns: 1.2fr 1fr min-content;
  grid-auto-rows: min-content;
  background: rgb(9, 26, 33);
  margin: 2rem;
  line-height: 1.5;
  position: relative;
  --logo-w: 68px;  
  --logo-h: 68px; 
  box-shadow: 0 4px 12px rgba(0,0,0,.3);
}

.badge-rack .logo {
  position: absolute;
  top: 4px;
  right: 16px;
  width: var(--logo-w);
  height: var(--logo-h);
  background: url(./img/logo.png) no-repeat 100% 0 / contain;
  margin: 0;
  z-index: 1;
  pointer-events: none;
  grid-column: auto;
  grid-row: auto;
}

.badge-rack .name {
  padding-right: calc(var(--logo-w) + 16px);
}

@media (max-width: 480px) {
  .badge-rack { --logo-w: 96px; --logo-h: 58px; }
}

.badge-rack > * { padding: 0.5rem 1rem; }

.badge-rack h1 { line-height: 1; margin: 0; font-size: 1.25em; }
.badge-rack .second { color: #fff; }

.badge-rack .name {
  background: #131314 url(./img/stripes_gray.svg);
  background-size: 500px;
  color: #fff;
  grid-column: 1 / 3;
  grid-row: 1;
  border-left: 5px solid #FFE710;
}

.badge-rack label {
  font-size: .85rem;
  color: #99880a;
  font-weight: 600;
}

.badge-rack .captain-badges {
  grid-column: 1 / 3;
  background: rgb(9, 26, 33);
  border-left: 5px solid rgb(51, 60, 66);
}
.badge-rack .challenge-badges {
  grid-column: 1 / 2;
  border-left: 5px solid rgb(51, 60, 66);
}
.badge-rack .type {
  grid-column: 1 / 3;
  border-left: 5px solid rgb(51, 60, 66);
  background: rgb(51, 60, 66);
}

/* Training flags */
.type { display: flex; align-items: center; gap: 18px; }
.flag {
  align-items: center;
  gap: 8px;
  font-family: 'FSSinclair', sans-serif;
  font-weight: 400;
  font-size: .8em;
  color: rgb(141, 239, 238);
  white-space: nowrap;
}
.flag::before {
  content: "";
  width: 18px;
  height: 18px;
  display: inline-block;
  background: transparent no-repeat center / contain;
}
.flag-bct::before { background-image: url('./img/realdeal.png'); }
.flag-at::before  { background-image: url('./img/patriot.png'); }

.badge-rack .date {
  grid-column: 1 / 3;
  font-family: "Swiss721", "Kanit", sans-serif;
  font-size: 70%;
  color: #FFE710;
  border-left: 5px solid rgb(51, 60, 66);
  text-align: right;
}
.badge-rack .footnote {
  grid-column: 1 / 3;
  grid-row: 6;
  border-left: 5px solid rgb(51, 60, 66);
  font-size: 50%;
  font-weight: 400;
  background: #000 url(./img/stripes_gray.svg);
  background-size: 500px;
  color: #fff;
  text-transform: uppercase;
}
.tag {
  font-family: 'FSSinclair', sans-serif;
  font-weight: 500;
  padding: 0 3px;
  background: rgb(141, 239, 238);
  color: #000;
  font-size: 14px;
}
.diver-title { display: inline-block; margin-bottom: 0; padding: 0; text-transform: uppercase; }

/* =============================
   Captains & Challenges Layout
============================= */
.badges-grid {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  align-items: center;
  justify-content: flex-start;
}
.badges-grid.centered { justify-content: center; }

.badge-box {
  background: #131314;
  width: 48px;
  height: 65px;
  border: 1px solid #fce650;
  border-radius: 5px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  box-shadow: 0 0 8px rgba(0,0,0,.2);
}
.badge-box img {
  width: 31px;
  height: 63px;
  object-fit: cover;
}

/* Hex slots */
.challenge-slot {
  width: var(--slot, 56px);
  height: var(--slot, 56px);
  display: flex;
  align-items: center;
  justify-content: center;
}
.challenge-slot svg { width: 100%; height: 100%; display: block; }
.hex-fill { fill: #131314; }
.hex-stroke { stroke: #4a4a4a; stroke-width: 2; }
.challenge-slot .hexagon img {
  width: 86%;
  height: 86%;
  object-fit: contain;
  image-rendering: crisp-edges;
}

/* Honeycomb */
.diamonds-grid {
  --slot: 56px;
  --gap: 8px;
  --lift: 0.26;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--gap);
  margin: 0 auto;
}
.diamonds-row {
  display: flex;
  gap: var(--gap);
  justify-content: center;
}
.diamonds-row.offset {
  --nudge: 32px;
  margin-left: calc((var(--slot) + var(--gap)) / 2 + var(--nudge));
  margin-top: calc(var(--slot) * var(--lift) * -1);
}
.challenge-slot { width: var(--slot); height: var(--slot); }
.challenge-slot .hexagon { width: 100%; height: 100%; }

/* =============================
   Crest Radio Group
============================= */
.crest-group {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: flex-start;
  justify-content: center;
}
.crest-group input[type="radio"] {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

/* Badge tiles */
.badge {
  position: relative;
  width: 108px;
  display: inline-block;
  margin: 8px 0;
  cursor: pointer;
  user-select: none;
  transition: transform .12s ease;
  font-size: 1em;
}
.badge svg { width: 108px; height: 55px; }
.badge:active { transform: translateY(1px); }

/* Title ribbon */
.badge .title {
  font-family: "Kanit", "FSSinclair", sans-serif;
  font-weight: 500;
  font-size: 0.85em;
  position: absolute;
  top: -14px;
  text-align: center;
  width: 100%;
  padding: 10px 0;
  color: #111;
  letter-spacing: .02em;
}

/* Subtitle (kept for compatibility, not used in current HTML) */
.badge .subtitle {
  font-family: "Kanit", "FSSinclair", sans-serif;
  font-size: 0.7em;
  width: 100%;
  text-align: center;
  text-transform: uppercase;
  color: white;
  top: 50px;
}
.badge .subtitle:after {
  content: "★ ★ ★";
  display: block;
  font-size: .4em;
  position: relative;
  margin: 7px 0 0;
  transition: all .3s;
}
.badge:hover .subtitle:after { word-spacing: 15px; }

/* Color helpers */
.badge.red    .title { background: #FE6D6A; }
.badge.red    .subtitle:after { color: #FE6D6A; }
.badge.green  .title { background: #2ecc71; }
.badge.green  .subtitle:after { color: #2ecc71; }
.badge.gray   .title { background: #95a5a6; }
.badge.gray   .subtitle:after { color: #95a5a6; }
.badge.yellow .title { background: #FFE710; }
.badge.yellow .subtitle:after { color: #FFE710; }
.badge.blue   .title { background: #3498db; }
.badge.blue   .subtitle:after { color: #3498db; }

/* Checked + focus states */
.crest-group input[type="radio"]:focus + .badge {
  outline: 1px solid #FFE710;
  outline-offset: 2px;
}
.crest-group input[type="radio"]:checked + .badge::after {
  content: "";
  position: absolute;
  inset: -5px;
  border: 1px solid #FFE710;
  pointer-events: none;
  box-shadow: 0 0 0 1px rgba(255,231,16,0.15), 0 2px 5px rgba(0,0,0,.35);
}

/* Placeholder images inside SVG hexes */
svg image.placeholder {
  filter: grayscale(100%) brightness(0.9);
  opacity: 0.6;
}

