/* alchemy.css V28 - adds image hover popup for gallery and amazon tiles */

/* Base theme */
:root {
  --bg: #0e1116;
  --bg-elev: #161a22;
  --text: #e6e9ef;
  --muted: #9aa4b2;
  --link: #7ab7ff;
  --link-hover: #a6ceff;
  --accent: #3b82f6;
  --border: #2a2f39;
  --row-alt: #12161d;
}

body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body.theme-dark {
  --bg: #0e1116;
  --bg-elev: #161a22;
  --text: #e6e9ef;
  --muted: #9aa4b2;
  --link: #7ab7ff;
  --link-hover: #a6ceff;
  --accent: #60a5fa;
  --border: #2a2f39;
  --row-alt: #12161d;
  background: var(--bg);
  color: var(--text);
}

.wrapper {
  max-width: 1100px;
  margin: 0 auto;
  padding: 24px 18px 60px;
}

/* Typography */
h1, h2, h3, h4 { color: var(--text); margin: 0 0 10px; }
.mega-title { font-size: 28px; font-weight: 700; letter-spacing: .2px; }

/* Links */
a { color: var(--link); text-decoration: none; }
a:hover { color: var(--link-hover); text-decoration: underline; }
a.unstyled-link { color: inherit; text-decoration: none; border-bottom: 1px dotted var(--border); }
a.unstyled-link:hover { color: var(--link-hover); border-bottom-color: var(--link-hover); }

/* Sections */
.section { margin: 18px 0 24px; padding: 16px; background: var(--bg-elev); border: 1px solid var(--border); border-radius: 10px; }

/* Hero */
.hero .lead { color: var(--muted); display: flex; gap: 16px; align-items: flex-start; }
.hero .lead img { max-height: 220px; border-radius: 8px; border: 1px solid var(--border); }

/* Facts */
.facts2 { display: grid; grid-template-columns: minmax(120px, 220px) 1fr; gap: 10px 16px; }
.facts2 .fact { display: contents; }
.facts2 .k { color: var(--muted); }
.facts2 .v { color: var(--text); }

/* Tables */
table { width: 100%; border-collapse: collapse; border-spacing: 0; }
table.sortable thead th {
  background: var(--bg-elev);
  position: sticky; top: 0;
  text-align: left; padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  font-weight: 600;
}
table.sortable tbody td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
}
table.sortable tbody tr:nth-child(2n) { background: var(--row-alt); }
.sort-indicator { opacity: .45; font-size: 12px; }

/* Attribute links */
a.attr-link { color: var(--link); }
a.attr-link:hover { color: var(--link-hover); }

/* Gallery */
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px; }
.gallery img { width: 100%; height: auto; border-radius: 8px; border: 1px solid var(--border); }

/* V28: Image hover popup */
.img-hover-wrap {
  position: relative;
  display: inline-block;
  cursor: zoom-in;
}

.img-hover-wrap img {
  transition: opacity 0.15s ease;
}

.img-hover-wrap::after {
  content: "";
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.85);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease, visibility 0.2s ease;
  z-index: 9998;
  pointer-events: none;
}

.img-hover-wrap:hover::after {
  opacity: 1;
  visibility: visible;
}

.img-hover-wrap:hover img {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  max-width: 90vw;
  max-height: 90vh;
  width: auto;
  height: auto;
  z-index: 9999;
  border: 2px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}

.gallery .img-hover-wrap {
  display: block;
}

.gallery .img-hover-wrap img {
  width: 100%;
  height: auto;
}

.amazon-tile .img-hover-wrap {
  display: block;
  margin-bottom: 10px;
}

.amazon-tile .img-hover-wrap img {
  max-width: 100%;
  max-height: 200px;
  width: auto;
  height: auto;
}

/* Footer */
.footer { margin-top: 28px; color: var(--muted); text-align: center; font-size: 13px; }

/* V27: Enrichment data display in Amazon tiles */
.subsection-enrichment {
  margin-top: 12px;
  border-top: 1px solid var(--border);
  padding-top: 12px;
}

.badge-buybox {
  display: inline-block;
  background: #22c55e;
  color: #000;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
}

.table-nested tr th {
  width: 40%;
  color: var(--muted);
  font-weight: 500;
  padding: 6px 8px;
}

.table-nested tr td {
  color: var(--text);
  padding: 6px 8px;
}

.table-nested {
  font-size: 13px;
}
