/* ============================================================
 * Utilities Bunker — Periodic Table (v2.1)
 * File: /assets/css/modules/resources/chemistry/periodic-table.v2.1.css
 * Purpose:
 *  - Page-only styling for the periodic table reference
 *  - Matches UB v2.1 reference layout / rail / cards
 *  - Keeps the table readable, responsive, and fast
 * Rules:
 *  - DO NOT modify ub-toolkit.v2.1.css
 *  - Mobile-first
 *  - No heavy effects
 * ============================================================ */

/* -----------------------------
   Page helpers
------------------------------ */
.ub-mono{
  font-family: var(--ub-mono);
}

.ub-sr-only{
  position:absolute !important;
  width:1px !important;
  height:1px !important;
  padding:0 !important;
  margin:-1px !important;
  overflow:hidden !important;
  clip:rect(0,0,0,0) !important;
  white-space:nowrap !important;
  border:0 !important;
}

.ub-pt-head{
  display:flex;
  gap:12px;
  justify-content:space-between;
  align-items:flex-start;
  flex-wrap:wrap;
}

.ub-pt-h1{
  margin:0;
  font-size: var(--ub-fs-5);
  letter-spacing:-0.02em;
}

.ub-pt-sub{
  max-width: 72ch;
}

.ub-pt-note{
  margin-top: 12px;
}

.ub-pt-small{
  margin: 10px 0 0;
  color: var(--ub-muted);
  font-size: var(--ub-fs-1);
}

.ub-pt-list{
  margin:0;
  padding-left:18px;
}

.ub-pt-list li{
  margin:6px 0;
}

.ub-pt-h3{
  margin: 0 0 12px;
  font-size: var(--ub-fs-2);
  font-weight: 950;
  letter-spacing: -0.01em;
}

.ub-pt-grid2{
  display:grid;
  grid-template-columns: 1.02fr 0.98fr;
  gap: var(--ub-gap);
}

@media (max-width: 980px){
  .ub-pt-grid2{
    grid-template-columns:1fr;
  }
}

/* -----------------------------
   Toolbar
------------------------------ */
.ub-pt-toolbar{
  display:flex;
  gap:12px;
  justify-content:space-between;
  align-items:center;
  flex-wrap:wrap;
  margin: 4px 0 14px;
}

.ub-pt-toolbar-group{
  display:flex;
  gap:10px;
  align-items:center;
  flex-wrap:wrap;
}

.ub-pt-search{
  min-width: 280px;
}

.ub-pt-filter{
  min-width: 220px;
}

@media (max-width: 760px){
  .ub-pt-toolbar{
    align-items:stretch;
  }

  .ub-pt-toolbar-group{
    width:100%;
  }

  .ub-pt-search,
  .ub-pt-filter{
    width:100%;
    min-width:0;
  }
}

/* -----------------------------
   Legend
------------------------------ */
.ub-pt-legend{
  display:flex;
  flex-wrap:wrap;
  gap:8px;
  margin: 0 0 14px;
}

.ub-pt-chip{
  display:inline-flex;
  align-items:center;
  gap:8px;
  min-height: 34px;
  padding: 5px 10px;
  border-radius: 999px;
  border: 1px solid var(--ub-border);
  background: var(--ub-surface-1);
  font-size: var(--ub-fs-1);
  line-height: 1.2;
}

.ub-pt-chip i{
  display:inline-block;
  width:12px;
  height:12px;
  border-radius:3px;
  flex:0 0 auto;
  border:1px solid rgba(0,0,0,.08);
}

html.ub-theme-dark .ub-pt-chip i{
  border-color: rgba(255,255,255,.10);
}

/* -----------------------------
   Category colors
------------------------------ */
.cat-alkali{ background:#ffe4e6; }
.cat-alk-earth{ background:#ffd7a8; }
.cat-transition{ background:#ddd6fe; }
.cat-metalloid{ background:#e9d5ff; }
.cat-nonmetal{ background:#bae6fd; }
.cat-halogen{ background:#fbcfe8; }
.cat-noble{ background:#c7f9cc; }
.cat-lanth{ background:#fef9c3; }
.cat-actin{ background:#fecaca; }
.cat-unknown{ background:#e5e7eb; }

html.ub-theme-dark .cat-alkali{ background:#4a1f2a; }
html.ub-theme-dark .cat-alk-earth{ background:#4a3316; }
html.ub-theme-dark .cat-transition{ background:#30285e; }
html.ub-theme-dark .cat-metalloid{ background:#45275a; }
html.ub-theme-dark .cat-nonmetal{ background:#163a52; }
html.ub-theme-dark .cat-halogen{ background:#4a2240; }
html.ub-theme-dark .cat-noble{ background:#1c4d32; }
html.ub-theme-dark .cat-lanth{ background:#4f4817; }
html.ub-theme-dark .cat-actin{ background:#552626; }
html.ub-theme-dark .cat-unknown{ background:#313743; }

/* -----------------------------
   Periodic table grid
------------------------------ */
.ub-pt-wrap{
  width:100%;
  overflow:auto;
  border-radius: var(--ub-radius-2);
  border: 1px solid var(--ub-border);
  background: var(--ub-surface-1);
  -webkit-overflow-scrolling: touch;
}

.ub-pt-wrap:focus-within{
  box-shadow: 0 0 0 4px var(--ub-focus);
}

.ub-pt-grid{
  display:grid;
  grid-template-columns: repeat(18, minmax(46px, 1fr));
  grid-auto-rows: 78px;
  gap: 6px;
  min-width: 1020px;
  padding: 8px;
  box-sizing: border-box;
}

.ub-pt-el{
  position:relative;
  display:flex;
  flex-direction:column;
  justify-content:space-between;
  align-items:flex-start;
  width:100%;
  min-height: 78px;
  padding: 6px;
  border: 1px solid var(--ub-border);
  border-radius: 12px;
  color: var(--ub-text);
  text-align:left;
  cursor:pointer;
  appearance:none;
  box-shadow:none;
  transition:
    transform .06s ease,
    box-shadow .12s ease,
    border-color .12s ease,
    outline-color .12s ease;
}

.ub-pt-el:hover{
  box-shadow: 0 4px 14px rgba(0,0,0,.06);
}

html.ub-theme-dark .ub-pt-el:hover{
  box-shadow: 0 4px 14px rgba(0,0,0,.20);
}

.ub-pt-el:focus-visible{
  outline: 3px solid var(--ub-focus-ring, rgba(249,58,19,.28));
  outline-offset: 1px;
}

.ub-pt-el.is-selected{
  border-color: var(--ub-accent);
  box-shadow: 0 0 0 2px rgba(249,58,19,.18);
}

html.ub-theme-dark .ub-pt-el.is-selected{
  box-shadow: 0 0 0 2px rgba(255,255,255,.12);
}

.ub-pt-el.is-hidden{
  display:none;
}

.ub-pt-el-z{
  position:absolute;
  top:6px;
  left:6px;
  font-size: 11px;
  line-height:1;
  color: var(--ub-muted);
  font-weight: 700;
}

.ub-pt-el-sym{
  margin-top: 14px;
  font-size: 20px;
  line-height:1;
  font-weight: 950;
  letter-spacing: -0.02em;
}

.ub-pt-el-name{
  width:100%;
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
  font-size: 11px;
  line-height:1.2;
  color: color-mix(in srgb, var(--ub-text) 76%, transparent);
}

.ub-pt-el-aw{
  width:100%;
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
  font-size: 11px;
  line-height:1.2;
  font-weight: 700;
}

/* -----------------------------
   Details block
------------------------------ */
.ub-pt-dl{
  display:grid;
  grid-template-columns: 170px 1fr;
  gap: 8px 12px;
}

.ub-pt-dl .k{
  color: var(--ub-muted);
  font-weight: 700;
}

.ub-pt-dl .v{
  min-width:0;
  overflow-wrap:anywhere;
}

@media (max-width: 760px){
  .ub-pt-dl{
    grid-template-columns:1fr;
    gap: 4px 0;
  }

  .ub-pt-dl .k{
    margin-top:8px;
  }

  .ub-pt-dl .k:first-child{
    margin-top:0;
  }
}

/* -----------------------------
   Tables
------------------------------ */
.ub-pt-tablewrap{
  width:100%;
  overflow:auto;
  border-radius: var(--ub-radius-2);
  border: 1px solid var(--ub-border);
  background: var(--ub-surface-1);
}

.ub-pt-tablewrap:focus-within{
  box-shadow: 0 0 0 4px var(--ub-focus);
}

.ub-pt-table{
  width:100%;
  border-collapse:collapse;
  min-width: 520px;
}

.ub-pt-table th,
.ub-pt-table td{
  padding: 10px 12px;
  text-align:left;
  vertical-align:top;
  border-bottom:1px solid var(--ub-border);
  font-size: var(--ub-fs-1);
}

.ub-pt-table thead th{
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--ub-surface-3);
  font-weight: 950;
  letter-spacing: .01em;
}

.ub-pt-table tbody tr:last-child td{
  border-bottom:none;
}

.ub-pt-table .ub-mono{
  font-size: 13px;
  line-height: 1.5;
}

@media (hover:hover){
  .ub-pt-table tbody tr:hover td{
    background: rgba(249,58,19,.04);
  }
}

html.ub-theme-dark .ub-pt-table tbody tr:hover td{
  background: rgba(255,255,255,.04);
}

/* -----------------------------
   Worked examples / tips
------------------------------ */
.ub-pt-exlist{
  margin:0;
  padding-left:18px;
}

.ub-pt-exlist li{
  margin:10px 0;
}

.ub-pt-exlist .ub-mono{
  overflow-wrap:anywhere;
}

.ub-pt-kbd{
  display:inline-flex;
  align-items:center;
  min-height:28px;
  padding:2px 8px;
  margin-right:6px;
  border-radius:8px;
  border:1px solid var(--ub-border);
  background: var(--ub-surface-2);
  font-family: var(--ub-mono);
  font-weight: 900;
  font-size: 12px;
}

/* -----------------------------
   Print
------------------------------ */
@media print{
  .ub-rail,
  .ub-rail-togglebar,
  .ub-rail-backdrop,
  #ubThemeToggle,
  #clearFiltersBtn,
  #btnCopySheet,
  #btnPrint,
  #btnShare{
    display:none !important;
  }

  .ub-card{
    box-shadow:none !important;
  }

  .ub-shell{
    max-width:100% !important;
    padding: 0 10mm !important;
  }

  .ub-pt-grid{
    min-width: 0 !important;
    grid-template-columns: repeat(18, minmax(0, 1fr));
    gap: 4px;
  }

  .ub-pt-el{
    min-height: 58px;
    padding: 4px;
    box-shadow:none !important;
    break-inside:avoid;
  }

  .ub-pt-table{
    min-width:0 !important;
  }

  a{
    text-decoration:none !important;
  }
}