
/* =========================================================
   #84 WiK Codex — Buildings
   V2 Black & Gold / Refined Satin Glass

   Background follows the fixed-image model used
   by the Sanctuary functional page.

   No CSS gap property.
   ========================================================= */

:root {
  --build-bg: #070807;
  --build-surface: #171615;
  --build-text: #F2F2F2;
  --build-muted: #C8C8C4;
  --build-gold: #D6AA4F;
  --build-highlight: #F3D27A;
  --build-radius: 14px;
  --font-ui: "Noto Sans JP","Hiragino Kaku Gothic ProN","Yu Gothic",sans-serif;
}
html:lang(en),html:lang(es){--font-ui:"Inter",Arial,sans-serif;}
html:lang(ru){--font-ui:"PT Sans",Arial,sans-serif;}

/* Header, Hero and background are controlled exclusively by shared V2 CSS. */

/* ---------------------------------------------------------
   3. Building list
   Solid background — no radial/linear gradients
   --------------------------------------------------------- */

.building-page {
  position: relative;
  z-index: 1;
  isolation: isolate;
  margin: 0;
  padding-top: 14px;
  padding-bottom: 32px;
}

.building-section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;

  min-width: 0;
  margin: 0 0 12px;
  padding: 0;
}

.building-section-heading h2 {
  min-width: 0;
  margin: 0;

  color: var(--build-text);
  font-size: 15px;
  font-weight: 500;
  line-height: 1.4;
}

.building-section-heading span {
  flex: 0 0 auto;
  margin-left: 12px;

  color: var(--build-gold);
  font-size: 11px;
  font-weight: 500;
  line-height: 1.4;
  white-space: nowrap;
}

.building-status {
  margin: 0;
  color: var(--build-muted);
  font-size: 12px;
  line-height: 1.5;
}

.building-status:empty {
  display: none;
}

/* ---------------------------------------------------------
   4. Three-column grid
   12px exterior / 12px between cards
   --------------------------------------------------------- */

.building-grid {
  position: relative;
  left: 50%;

  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));

  width: min(100vw, 43.5rem);
  margin: 0;
  padding: 6px;
  box-sizing: border-box;

  transform: translateX(-50%);
}

.building-cell {
  display: flex;
  min-width: 0;
  padding: 6px;
  box-sizing: border-box;
}

/* ---------------------------------------------------------
   5. Refined Satin Glass cards
   --------------------------------------------------------- */

.building-card {
  position: relative;
  isolation: isolate;

  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;

  width: 100%;
  min-width: 0;
  min-height: 125px;
  height: 100%;

  margin: 0;
  padding: 9px 4px 10px;

  box-sizing: border-box;
  overflow: hidden;

  border: 0;
  border-radius: var(--build-radius);

  background:
    linear-gradient(
      145deg,
      rgba(255,255,255,.065) 0%,
      rgba(255,255,255,.024) 48%,
      rgba(18,21,21,.22) 100%
    ),
    rgba(48,47,43,.42);

  -webkit-backdrop-filter: blur(15px) saturate(118%);
  backdrop-filter: blur(15px) saturate(118%);

  box-shadow: 0 .9rem 1.9rem rgba(0,0,0,.28);

  color: var(--build-text);
  font: inherit;
  text-align: center;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;

  transition: box-shadow 180ms ease;
}

.building-card::before {
  content: "";
  position: absolute;
  z-index: 2;
  inset: 0;

  padding: 1px;
  box-sizing: border-box;
  border-radius: inherit;
  pointer-events: none;

  background: linear-gradient(
    135deg,
    rgba(255,255,255,.76) 0%,
    rgba(255,255,255,.30) 18%,
    rgba(255,255,255,.10) 37%,
    rgba(255,255,255,.08) 63%,
    rgba(255,255,255,.25) 83%,
    rgba(255,255,255,.60) 100%
  );

  -webkit-mask:
    linear-gradient(#000 0 0) content-box,
    linear-gradient(#000 0 0);

  -webkit-mask-composite: xor;
  mask-composite: exclude;
}

.building-card::after {
  content: "";
  position: absolute;
  z-index: 0;
  inset: 0;

  border-radius: inherit;
  pointer-events: none;

  background:
    radial-gradient(
      ellipse 95% 100% at -2% -12%,
      rgba(255,255,255,.12) 0%,
      transparent 75%
    ),
    radial-gradient(
      ellipse 92% 95% at 105% 110%,
      rgba(255,255,255,.08) 0%,
      transparent 62%
    );
}

.building-card > img,
.building-card > .building-card-name,
.building-card {
  position: relative;
  z-index: 3;
}

.building-card > img {
  display: block;
  flex: 0 0 76px;

  width: 76px;
  height: 76px;
  max-width: 100%;

  margin: 0 auto 6px;
  padding: 0;

  object-fit: contain;
  object-position: center;
}

.building-card-name {
  display: flex;
  align-items: center;
  justify-content: center;

  width: 100%;
  min-width: 0;
  min-height: 28px;

  margin: 0;
  padding: 0;

  color: var(--build-text);
  font-size: 11px;
  font-weight: 500;
  line-height: 1.3;
  letter-spacing: -.01em;
  text-align: center;

  overflow-wrap: anywhere;
  hyphens: auto;
}

.building-card:hover {
  box-shadow: 0 1.1rem 2rem rgba(0,0,0,.36);
}

.building-card:focus-visible {
  outline: 2px solid var(--build-highlight);
  outline-offset: 2px;
}

/* ---------------------------------------------------------
   6. Calculator modal
   --------------------------------------------------------- */

body.bc-locked {
  overflow: hidden;
}

.bc-modal {
  width: 100%;
  max-width: 100%;
  height: 100dvh;
  max-height: 100dvh;

  margin: auto;
  padding: 0;

  box-sizing: border-box;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;

  border: 0;
  border-radius: 0;

  background: #101112;
  color: var(--build-text);

  font-family: var(--font-ui);
  font-size: 13px;
  line-height: 1.5;
}

.bc-modal::backdrop {
  background: rgba(0,0,0,.78);
}

.bc-sticky {
  position: sticky;
  z-index: 5;
  top: 0;

  padding:
    calc(12px + env(safe-area-inset-top, 0px))
    16px
    12px;

  border-bottom: 1px solid rgba(255,255,255,.13);

  background: rgba(16,17,18,.96);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
}

.bc-topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.bc-topline strong {
  min-width: 0;
  color: var(--build-gold);
  font-size: 12px;
  font-weight: 600;
  line-height: 1.4;
  letter-spacing: .04em;
}

.bc-close {
  display: flex;
  flex: 0 0 44px;
  align-items: center;
  justify-content: center;

  width: 44px;
  height: 44px;

  margin: 0 0 0 12px;
  padding: 0;

  border: 1px solid rgba(255,255,255,.14);
  border-radius: 50%;

  background: #242424;
  color: var(--build-text);

  font-size: 26px;
  font-weight: 400;
  line-height: 1;
  cursor: pointer;
}

.bc-close:hover {
  background: #303030;
}

.bc-close:focus-visible {
  outline: 2px solid var(--build-highlight);
  outline-offset: 2px;
}

.bc-disclaimer {
  margin: 5px 0 0;
  color: var(--build-muted);
  font-size: 12px;
  line-height: 1.5;
}

.bc-content {
  width: 100%;
  max-width: 610px;
  margin: 0 auto;

  padding:
    16px
    12px
    calc(32px + env(safe-area-inset-bottom, 0px));

  box-sizing: border-box;
}

.bc-building {
  display: flex;
  align-items: center;
  min-width: 0;
  margin: 0 0 14px;
}

.bc-building > img {
  display: block;
  flex: 0 0 68px;

  width: 68px;
  height: 68px;
  max-width: 68px;
  object-fit: contain;
}

.bc-building-names {
  min-width: 0;
  padding-left: 12px;
}

.bc-building-names h2 {
  margin: 0;
  color: var(--build-text);
  font-size: 18px;
  font-weight: 600;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.bc-building-names p {
  margin: 4px 0 0;
  color: var(--build-muted);
  font-size: 12px;
  line-height: 1.4;
}

.bc-panel {
  padding: 12px;
  box-sizing: border-box;

  border: 1px solid #353535;
  border-radius: 14px;
  background: #191919;
}

.bc-fields {
  display: grid;
  grid-template-columns: minmax(0,1fr) 18px minmax(0,1fr);
  align-items: end;
}

.bc-fields label {
  display: block;
  min-width: 0;
}

.bc-fields label > span {
  display: block;
  margin: 0 0 6px;
  color: var(--build-muted);
  font-size: 12px;
  font-weight: 500;
  line-height: 1.4;
}

.bc-fields select {
  display: block;
  width: 100%;
  min-width: 0;
  height: 44px;

  margin: 0;
  padding: 0 8px;
  box-sizing: border-box;

  border: 1px solid #353535;
  border-radius: 10px;
  outline: none;

  background: #111111;
  color: var(--build-text);

  font: inherit;
  font-size: 13px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  cursor: pointer;
}

.bc-fields select:focus-visible {
  border-color: var(--build-gold);
  outline: 2px solid rgba(214,170,79,.35);
  outline-offset: 1px;
}

.bc-arrow {
  padding-bottom: 12px;
  color: var(--build-gold);
  font-size: 13px;
  text-align: center;
}

.bc-submit {
  display: block;
  width: 100%;
  min-height: 44px;
  margin: 12px 0 0;
  padding: 0 12px;

  border: 0;
  border-radius: 10px;

  background: linear-gradient(
    180deg,
    #FFE49C 0%,
    #EFCB71 45%,
    #C99534 100%
  );

  color: #17120B;
  font: inherit;
  font-size: 13px;
  font-weight: 700;

  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.38),
    0 7px 16px rgba(0,0,0,.25);

  cursor: pointer;
}

.bc-submit:focus-visible {
  outline: 2px solid var(--build-highlight);
  outline-offset: 3px;
}

.bc-error {
  margin: 12px 0 0;
  color: #FFD0A6;
  font-size: 12px;
  line-height: 1.5;
}

/* ---------------------------------------------------------
   7. Calculation results
   --------------------------------------------------------- */

.bc-total {
  margin-top: 12px;
  overflow: hidden;

  border: 1px solid rgba(214,170,79,.38);
  border-radius: 13px;

  background: #171615;
}

.bc-total-head {
  display: flex;
  align-items: center;
  justify-content: space-between;

  min-height: 40px;
  padding: 10px 12px;

  background: #242019;
}

.bc-total-head strong {
  color: var(--build-highlight);
  font-size: 13px;
  font-weight: 600;
}

.bc-total-head span {
  margin-left: 8px;
  color: var(--build-text);
  font-size: 11px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.bc-resources {
  display: grid;
  grid-template-columns: repeat(3,minmax(0,1fr));
}

.bc-resource {
  min-width: 0;
  padding: 12px 4px;
  box-sizing: border-box;

  border-right: 1px solid rgba(255,255,255,.085);
  text-align: center;
}

.bc-resource:last-child {
  border-right: 0;
}

.bc-resource-top {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
}

.bc-resource-top img {
  display: block;
  flex: 0 0 18px;
  width: 18px;
  height: 18px;
  object-fit: contain;
}

.bc-resource-top strong {
  display: block;
  min-width: 0;
  padding-left: 4px;

  color: var(--build-highlight);
  font-size: 15px;
  font-weight: 700;
  line-height: 1.35;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.bc-resource-label {
  display: block;
  margin-top: 3px;

  color: var(--build-muted);
  font-size: 11px;
  line-height: 1.4;
}

.bc-resource-exact {
  display: block;
  margin-top: 2px;

  color: var(--build-text);
  font-size: 10px;
  line-height: 1.4;
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}

.bc-total-time {
  display: flex;
  align-items: center;
  justify-content: space-between;

  min-height: 50px;
  padding: 12px;

  border-top: 1px solid rgba(214,170,79,.15);
}

.bc-total-time span {
  color: var(--build-muted);
  font-size: 12px;
}

.bc-total-time strong {
  margin-left: 12px;

  color: var(--build-highlight);
  font-size: 14px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  text-align: right;
}

/* ---------------------------------------------------------
   8. Level-by-level breakdown
   --------------------------------------------------------- */

.bc-breakdown {
  padding-top: 17px;
}

.bc-breakdown h3 {
  margin: 0 0 10px;
  color: var(--build-text);
  font-size: 14px;
  font-weight: 500;
  line-height: 1.4;
}

.bc-stage {
  margin: 0 0 10px;
  padding: 12px;

  border: 1px solid rgba(255,255,255,.09);
  border-radius: 12px;
  background: #1A1A1A;
}

.bc-stage-title {
  margin: 0 0 7px;

  color: var(--build-highlight);
  font-size: 12px;
  font-weight: 600;
  line-height: 1.4;
}

.bc-stage .bc-resource {
  text-align: left;
}

.bc-stage .bc-resource-top {
  justify-content: flex-start;
}

.bc-stage .bc-resource-top strong {
  font-size: 13px;
}

.bc-stage .bc-resource-exact {
  color: var(--build-muted);
  font-size: 9px;
}

.bc-stage-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;

  padding-top: 10px;
  border-top: 1px solid rgba(255,255,255,.085);
}

.bc-stage-meta span {
  color: var(--build-muted);
  font-size: 11px;
}

.bc-stage-meta strong {
  margin-left: 12px;

  color: var(--build-text);
  font-size: 11px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.bc-stage-requirements {
  margin: 9px 0 0;
  color: var(--build-muted);
  font-size: 11px;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

/* ---------------------------------------------------------
   9. Narrow phones
   --------------------------------------------------------- */

@media (max-width: 359px) {
  .building-card {
    min-height: 116px;
    padding: 7px 3px 9px;
  }

  .building-card > img {
    flex-basis: 64px;
  }

  .building-card-name {
    font-size: 10px;
  }

  .bc-resource {
    padding-right: 2px;
    padding-left: 2px;
  }

  .bc-resource-top img {
    flex-basis: 16px;
    width: 16px;
    height: 16px;
  }

  .bc-resource-top strong {
    padding-left: 3px;
    font-size: 13px;
  }

  .bc-resource-exact {
    font-size: 9px;
  }

  .bc-stage .bc-resource-top strong {
    font-size: 12px;
  }
}

/* ---------------------------------------------------------
   10. Desktop modal
   --------------------------------------------------------- */

@media (min-width: 700px) {
  .bc-modal {
    width: 610px;
    max-width: calc(100vw - 32px);
    height: min(92dvh,900px);
    max-height: 92dvh;

    border: 1px solid #4D4332;
    border-radius: 18px;
  }
}

/* ---------------------------------------------------------
   11. Accessibility / compatibility
   --------------------------------------------------------- */

@media (prefers-reduced-transparency: reduce) {
  .building-card {
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
    background: rgba(35,35,33,.94);
  }

  .bc-sticky {
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
    background: #101112;
  }
}

@media (prefers-reduced-motion: reduce) {
  .building-card {
    transition: none;
  }
}

@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .building-card {
    background: rgba(35,35,33,.88);
  }

  .bc-sticky {
    background: #101112;
  }
}
