/* Aetas — techboom en counters (wiki/techtree, wiki/counters)

   Alleen op die twee pagina's geladen; de rest van de site merkt hier niets van. Zelfde
   regels als style.css: bijna rechte hoeken, haarlijnen in brons, brons als enige accent;
   groen/oranje/blauw betekenen iets (bonus / ontbreekt / vervangen of eerder).
   Zonder JavaScript is elke knoop een <details>: tikken klapt de cijfers uit. Met
   JavaScript (.tt.is-js) verschijnen ze in een zwevend kaartje (.tt-pop). */

.tt { margin-top: 1.25rem; min-width: 0; }
/* De wikikolom is een grid-kolom van 1fr: zonder min-width 0 duwt een brede tabel de hele
   pagina op een telefoon breder dan het scherm. Hier alleen voor deze twee pagina's. */
.wrap--wiki > .prose--wiki { min-width: 0; }
.prose .tt ul, .prose .tt ol { padding-left: 0; }
.prose .tt li { max-width: none; }
.prose .tt li + li { margin-top: 0; }
.prose--wiki .tt .table-wrap { max-width: none; }
.tt > * + * { margin-top: 1rem; }
.prose .tt > h2 { margin-top: 2.6rem; }

/* ------------------------------------------------------------ beschaving kiezen */

.tt-civs {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .4rem;
  padding: .7rem 0;
  border-block: 1px solid var(--edge-soft);
}
.tt-civs__label {
  font-family: "Cinzel", Georgia, serif;
  font-size: .7rem;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--brons-dim);
  margin-right: .3rem;
}
.tt-civ {
  display: inline-block;
  padding: .3rem .7rem;
  border: 1px solid var(--edge-soft);
  border-radius: var(--radius);
  color: var(--dim);
  text-decoration: none;
  font-size: .9rem;
  line-height: 1.3;
  background: var(--inner);
}
.tt-civ:hover { color: var(--text); border-color: var(--brons-off); }
.tt-civ.is-current { color: var(--bg); background: var(--brons); border-color: var(--brons); }
/* Zonder JS doet een keuze niets: dan staat alles er met labels, en geen kiezer. */
.tt:not(.is-js) .tt-civs { display: none; }

@media (max-width: 560px) {
  .tt-civs { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: thin; -webkit-overflow-scrolling: touch; }
  .tt-civ { white-space: nowrap; flex: none; }
}

.tt-legend {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: .4rem 1.1rem;
  margin: .8rem 0 0;
  font-size: .82rem;
  color: var(--dimmer);
}
.tt-legend li { display: inline-flex; align-items: center; gap: .4rem; }
.tt-legend .tt-ico { width: 18px; height: 18px; font-size: 0; }

.tt-civinfo {
  margin-top: 1rem;
  border: 1px solid var(--edge-soft);
  border-left: 3px solid var(--brons);
  background: var(--panel);
  padding: .8rem 1rem;
  font-size: .9rem;
}
.tt-civinfo[hidden] { display: none; }
.prose .tt-civinfo__name { margin: 0; font-size: 1.05rem; }
.tt-civinfo__trait { color: var(--text); font-weight: 600; margin: .3rem 0 .4rem; }
.prose .tt-civinfo ul { list-style: none; columns: 2 18rem; column-gap: 1.5rem; color: var(--dim); margin: 0; }
.tt-civinfo li { break-inside: avoid; padding: .1rem 0 .1rem .8rem; position: relative; }
.tt-civinfo li::before { content: ""; position: absolute; left: 0; top: .7em; width: .35rem; height: 1px; background: var(--brons-off); }
.tt-civinfo__more { margin: .5rem 0 0; color: var(--dimmer); font-size: .85rem; }

/* ------------------------------------------------------------ tijdperken */

.tt-age { margin-top: 2.2rem; }
.tt-age__head { display: flex; flex-wrap: wrap; align-items: baseline; gap: .2rem 1.2rem; }
.prose .tt-age__head h2 { margin: 0; }
.tt-age__n { color: var(--age, var(--brons)); }
.prose .tt-age__cost { margin: 0; font-size: .85rem; color: var(--dimmer); }

.tt-lanes {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(196px, 100%), 1fr));
  gap: .6rem;
  margin-top: .8rem;
  align-items: start;
}
.tt-lane {
  border: 1px solid var(--edge-soft);
  border-top: 2px solid var(--age, var(--brons-off));
  background: var(--panel);
  min-width: 0;
}
.prose .tt-lane__head {
  margin: 0;
  padding: .4rem .6rem;
  font-family: "Cinzel", Georgia, serif;
  font-size: .72rem;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--dim);
  border-bottom: 1px solid var(--edge-soft);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .3rem .5rem;
}
.tt-lane__head .tt-tag { font-family: "Alegreya Sans", sans-serif; letter-spacing: .04em; text-transform: none; }
.prose .tt-nodes { list-style: none; margin: 0; padding: .25rem; }

/* ------------------------------------------------------------ knopen */

.tt-node { position: relative; }
.tt-node > details > summary {
  display: flex;
  align-items: center;
  gap: .5rem;
  padding: .3rem .35rem;
  cursor: pointer;
  list-style: none;
  border: 1px solid transparent;
  border-radius: var(--radius);
  min-height: 40px;
}
.tt-node > details > summary::-webkit-details-marker { display: none; }
.tt-node > details > summary:hover,
.tt-node > details > summary:focus-visible { background: rgba(200, 150, 60, .07); border-color: var(--brons-off); outline: none; }
.tt-label { display: flex; flex-wrap: wrap; align-items: center; gap: .15rem .35rem; min-width: 0; line-height: 1.25; }
.tt-name { font-size: .92rem; color: var(--text); }
.tt-node--tech .tt-name { color: var(--dim); font-size: .88rem; }
.tt-node--building .tt-name { font-weight: 600; }

.tt-ico {
  flex: none;
  width: 30px;
  height: 30px;
  display: inline-grid;
  place-items: center;
  font-family: "Cinzel", Georgia, serif;
  font-size: .8rem;
  font-weight: 700;
  border-radius: var(--radius);
}
.tt-ico--unit { background: #2a2419; border: 1px solid var(--edge); color: var(--text); }
.tt-ico--building { background: var(--brons-off); border: 1px solid var(--brons-dim); color: var(--text); }
.tt-ico--tech {
  width: 14px; height: 14px; margin: 0 8px;
  transform: rotate(45deg);
  border: 1px solid var(--info);
  background: rgba(127, 168, 196, .18);
}
.tt-legend .tt-ico--tech { width: 12px; height: 12px; margin: 0 3px; }
.tt-ico--img { width: 40px; height: 40px; overflow: hidden; }
.prose .tt-ico--img .tt-sprite { width: auto; height: 40px; max-width: 40px; object-fit: contain; border: 0; }

/* Uitgeklapt zonder JS: de cijfers onder de knoop. */
.tt-info { padding: .4rem .5rem .6rem; font-size: .84rem; }
.prose .tt-info__head { font-weight: 700; color: var(--text); margin: 0 0 .3rem; }
.tt-info dl { display: grid; grid-template-columns: auto 1fr; gap: .12rem .7rem; margin: 0; }
.tt-info dt { color: var(--off); }
.tt-info dd { margin: 0; color: var(--dim); min-width: 0; }
.tt-info .cost { font-size: .82rem; margin-right: .3rem; }
.prose .tt-info__more { margin: .4rem 0 0; }
.tt-mult { color: var(--good); font-weight: 700; }

/* labels */
.tt-tag {
  display: inline-block;
  font-size: .68rem;
  letter-spacing: .03em;
  line-height: 1.35;
  border: 1px solid currentColor;
  border-radius: var(--radius);
  padding: 0 .3rem;
  max-width: 100%;
}
.tt-tag[hidden] { display: none; }
.tt-tag--own { color: var(--brons); }
.tt-tag--off { color: var(--warn); }
.tt-tag--repl, .tt-tag--early { color: var(--info); }
.tt-tag--boost { color: var(--good); }

/* gekozen beschaving: wat het volk niet heeft grijs, unieke dingen van anderen weg */
.tt .is-off { opacity: .42; filter: grayscale(1); }
.tt .is-off .tt-name { text-decoration: line-through; text-decoration-color: rgba(224, 120, 74, .7); }
.tt .is-hidden { display: none !important; }
.tt-node.is-own > details > summary { border-color: var(--brons-dim); background: rgba(200, 150, 60, .08); }

/* een lijn oplichten */
.tt.has-chain .tt-node:not(.is-chain) { opacity: .55; }
.tt.has-chain .tt-node.is-off:not(.is-chain) { opacity: .25; }
.tt-node.is-chain > details > summary { border-color: var(--brons); background: rgba(200, 150, 60, .13); }
.tt-node.is-active > details > summary { box-shadow: inset 3px 0 0 var(--brons); }

/* ------------------------------------------------------------ zwevend kaartje */

.tt.is-js .tt-node > details > .tt-info { display: none; }
.tt-pop {
  position: absolute;
  z-index: 60;
  width: min(320px, calc(100vw - 32px));
  background: var(--band);
  border: 1px solid var(--edge);
  border-top: 2px solid var(--brons);
  box-shadow: 0 10px 30px rgba(0, 0, 0, .55);
  font-size: .86rem;
}
.tt-pop[hidden] { display: none; }
.tt-pop .tt-info { display: block; padding: .7rem .85rem .8rem; }
.tt-pop .tt-info__head { font-size: 1rem; padding-right: 2rem; }
.tt-pop .tt-info__head, .tt-pop .tt-info__more { margin: 0 0 .35rem; }
.tt-pop .tt-info__more { margin: .5rem 0 0; }
.tt-pop__close {
  position: absolute;
  top: .25rem; right: .25rem;
  width: 36px; height: 36px;
  background: none;
  border: 0;
  color: var(--dim);
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
}
.tt-pop__close:hover { color: var(--text); }
@media (max-width: 600px) {
  .tt-pop {
    position: fixed;
    left: 0 !important; right: 0; bottom: 0; top: auto !important;
    width: auto;
    max-height: 62vh;
    overflow-y: auto;
    border-left: 0; border-right: 0; border-bottom: 0;
    padding-bottom: env(safe-area-inset-bottom);
  }
}

/* ------------------------------------------------------------ mobiel */

@media (max-width: 560px) {
  .tt-lanes { grid-template-columns: minmax(0, 1fr); }
  .prose .tt-nodes { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 0 .2rem; }
  .tt:not(.is-js) .tt-node:has(details[open]) { grid-column: 1 / -1; }
}

/* ------------------------------------------------------------ counters */

.tt-matrix td, .tt-matrix th { white-space: nowrap; }
.tt-matrix td .muted { font-weight: 400; font-size: .8rem; margin-left: .2rem; }
.prose .tt-notes, .prose .tt-rules { list-style: none; margin: .6rem 0 0; font-size: .92rem; color: var(--dim); }
.tt-notes li, .tt-rules li { padding: .15rem 0 .15rem .9rem; position: relative; }
.tt-notes li::before, .tt-rules li::before { content: ""; position: absolute; left: 0; top: .8em; width: .4rem; height: 1px; background: var(--brons-off); }

.tt-ctable td { min-width: 9rem; }
.tt-ctable .cell-name { min-width: 11rem; white-space: normal; }
.tt-cname { display: flex; align-items: center; gap: .55rem; }
.tt-cname .tt-tag { margin: .2rem .25rem 0 0; font-weight: 400; }
.tt-refs { display: flex; flex-wrap: wrap; gap: .25rem; margin-top: .3rem; }
.tt-ref {
  display: inline-flex;
  align-items: center;
  gap: .25rem;
  font-size: .8rem;
  padding: .05rem .4rem;
  border: 1px solid var(--edge-soft);
  border-radius: var(--radius);
  color: var(--dim);
  text-decoration: none;
  background: var(--inner);
  white-space: nowrap;
}
.tt-ref:hover { color: var(--text); border-color: var(--brons-off); }
.tt-ref .tt-mult { font-size: .75rem; }
.tt-ctable tr:target td { background: rgba(200, 150, 60, .1); }
.tt-notes .tt-refs { display: inline-flex; margin: 0 0 0 .35rem; vertical-align: middle; }

/* Op een telefoon: geen tabel van drie kolommen maar per unit een blok, met de kop
   (sterk/zwak tegen) als label erboven. */
@media (max-width: 560px) {
  .tt-ctable thead { display: none; }
  .tt-ctable, .tt-ctable tbody, .tt-ctable tr, .tt-ctable td { display: block; width: 100%; }
  .tt-ctable tr { padding: .55rem .6rem; border-bottom: 1px solid var(--edge-soft); }
  .tt-ctable tbody td { border: 0; padding: .2rem 0; min-width: 0; }
  .tt-ctable td[data-label]::before {
    content: attr(data-label);
    display: block;
    font-family: "Cinzel", Georgia, serif;
    font-size: .66rem;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: var(--brons-dim);
    margin-bottom: .1rem;
  }
  .tt-ctable .cell-name { min-width: 0; }
}
