/* Homepage tile hub */

body {
  background: #fafafa !important;
}

:root {
  --tile-accent: #1e8d20;
  --tile-bg: #dcdcdc;
  --tile-bg-hover: #111111;
  --tile-fg: #111111;
  --tile-fg-hover: #ffffff;
  --tile-desc: #444444;
  --tile-desc-hover: rgba(255, 255, 255, 0.88);
  --tile-border: rgba(0, 0, 0, 0.16);
  /* Hover glow: black shadow + green halo */
  --tile-shadow: 0 12px 30px rgba(0, 0, 0, 0.18), 0 0 0 2px rgba(30, 141, 32, 0.18),
    0 0 18px rgba(30, 141, 32, 0.35);

  /* Optional tile background image (set per-tile via inline style / CSS class) */
  --tile-bg-image: none; /* example: url('/static/tss_admin/images/sneakerconbw.jpg') */
  --tile-bg-opacity: 0.28; /* how visible the image is */
  --tile-overlay-light: rgba(250, 250, 250, 0.58); /* keeps dark text readable */
  --tile-overlay-dark: rgba(17, 17, 17, 0.60); /* keeps white text readable on hover */
  --tile-overlay-dark-hover: rgba(17, 17, 17, 0.44); /* show more image on hover */
  --tile-hover-outline: rgba(30, 141, 32, 0.92);
}

.tss-home {
  padding-top: 40px;
  padding-bottom: 30px;
}

.tss-home-header {
  text-align: center;
  margin-bottom: 25px;
}

.tss-home-logo {
  display: block;
  margin: 0 auto 10px auto;
  max-width: 84px;
  height: auto;
}

.tss-home-title {
  margin: 0;
}

.tss-home-subtitle {
  margin: 10px 0 0 0;
  color: #555;
  font-size: 16px;
}

.tss-tile-grid {
  margin-top: 10px;
  display: grid;
  grid-template-columns: 1fr; /* mobile */
  gap: 16px;
}

.tss-tile-cell {
  min-width: 0;
}

/* Tablet: 2 columns */
@media (min-width: 700px) {
  .tss-tile-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* Desktop: 3 columns */
@media (min-width: 992px) {
  .tss-tile-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

a.tss-tile-frame,
.tss-tile-frame {
  display: block;
  height: 100%;
  padding: 18px 18px 16px 18px;
  border: 1px solid var(--tile-border);
  background: var(--tile-bg);
  color: var(--tile-fg);
  text-decoration: none;
  transition: transform 0.12s ease, background-color 0.12s ease, box-shadow 0.12s ease;
  min-height: 190px;
  position: relative;
  overflow: hidden;
}

a.tss-tile-frame::before,
.tss-tile-frame::before,
.tss-tile-split-half::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: var(--tile-bg-image, none);
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  opacity: var(--tile-bg-opacity, 0.18);
  filter: saturate(1.05) contrast(1.05);
  transform: scale(1.03);
  z-index: 0;
  pointer-events: none;
}

a.tss-tile-frame::after,
.tss-tile-frame::after,
.tss-tile-split-half::after {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--tile-overlay-light);
  z-index: 0;
  pointer-events: none;
}

.tss-tile-inner {
  position: relative;
  z-index: 1;
}

a.tss-tile-frame:hover {
  transform: translateY(-2px);
  background: var(--tile-bg-hover);
  color: var(--tile-fg-hover);
  box-shadow: var(--tile-shadow);
}

a.tss-tile-frame:hover::before,
.tss-tile-split-half:hover::before {
  /* "Preview" effect: reveal more of the image on hover */
  opacity: clamp(0, calc(var(--tile-bg-opacity, 0.28) * 1.35), 1);
}

a.tss-tile-frame:hover::after,
.tss-tile-split-half:hover::after {
  background: var(--tile-overlay-dark-hover);
}

a.tss-tile-frame:focus,
a.tss-tile-frame:focus-visible {
  outline: 2px solid #111;
  outline-offset: 3px;
}

.tss-tile-inner {
  display: flex;
  gap: 14px;
  align-items: flex-start;
}

.tss-tile-icon {
  width: 34px;
  text-align: center;
  font-size: 22px;
  line-height: 1;
  margin-top: 3px;
  color: var(--tile-accent);
}

a.tss-tile-frame:hover .tss-tile-icon {
  color: var(--tile-fg-hover);
}

.tss-tile-text {
  min-width: 0; /* critical: allow text to shrink inside flex */
  flex: 1 1 auto;
}

.tss-tile-title {
  margin: 0;
  font-size: 18px;
  letter-spacing: 0.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--tile-fg) !important;
}

a.tss-tile-frame:hover .tss-tile-title {
  color: var(--tile-fg-hover) !important;
}

.tss-tile-split-half:hover .tss-tile-title,
a.tss-tile-frame:hover .tss-tile-title {
  /* Green outline for readability on hover */
  text-shadow:
    -1px -1px 0 var(--tile-hover-outline),
    1px -1px 0 var(--tile-hover-outline),
    -1px 1px 0 var(--tile-hover-outline),
    1px 1px 0 var(--tile-hover-outline),
    0 2px 10px rgba(0, 0, 0, 0.55);
}

.tss-tile-desc {
  margin: 6px 0 0 0;
  font-size: 14px;
  line-height: 1.4;
  color: var(--tile-desc) !important; /* override global p color rules */
  text-transform: none;
  letter-spacing: 0;
  -webkit-text-stroke: 0;
  text-stroke: 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

a.tss-tile-frame:hover .tss-tile-desc {
  color: var(--tile-desc-hover) !important;
}

.tss-tile-split-half:hover .tss-tile-desc,
a.tss-tile-frame:hover .tss-tile-desc {
  /* Softer outline for smaller body text */
  text-shadow:
    -1px 0 0 rgba(30, 141, 32, 0.55),
    1px 0 0 rgba(30, 141, 32, 0.55),
    0 1px 8px rgba(0, 0, 0, 0.55);
}

.tss-tile-spacer {
  margin-bottom: 16px;
}

/* (Legacy) previously forced perfect squares; no longer used. */
.tss-tile-square {
  min-height: 190px;
}

/* Split tile (lookup + grader) */
.tss-tile-frame.tss-tile-split {
  padding: 0;
  display: flex;
  overflow: hidden;
  background: var(--tile-bg);
  box-shadow: none;
  align-items: stretch;
  position: relative;
}

.tss-tile-frame.tss-tile-split:hover {
  box-shadow: var(--tile-shadow);
}

.tss-tile-split-half {
  display: block;
  width: 50%;
  padding: 18px 18px 16px 18px;
  color: inherit;
  text-decoration: none;
  display: flex;
  flex-direction: column;
  justify-content: center;
  background: transparent;
  flex: 1 1 50%;
  min-height: inherit;
  align-items: center;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.tss-tile-split-half .tss-tile-inner {
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 10px;
}

.tss-tile-split-half .tss-tile-icon {
  margin-top: 0;
}

.tss-tile-split-half + .tss-tile-split-half {
  border-left: 1px solid var(--tile-border);
}

.tss-tile-split-half:hover {
  text-decoration: none;
  background: var(--tile-bg-hover);
  color: var(--tile-fg-hover);
}

.tss-tile-split-half:hover .tss-tile-icon {
  color: var(--tile-fg-hover);
}

.tss-tile-split-half:hover .tss-tile-desc {
  color: var(--tile-desc-hover) !important;
}

.tss-tile-split-half:hover .tss-tile-title {
  color: var(--tile-fg-hover) !important;
}

/* Sticky mini header (appears on scroll) */
.tss-sticky-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  transform: translateY(-110%);
  transition: transform 0.18s ease;
  background: rgba(250, 250, 250, 0.95);
  border-bottom: 1px solid rgba(0, 0, 0, 0.12);
  backdrop-filter: blur(6px);
}

.tss-sticky-header.is-visible {
  transform: translateY(0);
}

.tss-sticky-header-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 10px 16px 12px 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.tss-sticky-logo {
  width: 32px;
  height: 32px;
}

.tss-sticky-title {
  font-size: 15px;
  margin: 0;
  line-height: 1;
}

/* Split tile: match other tiles, stretch divider, and don't truncate text */
.tss-tile-frame.tss-tile-split {
  align-items: stretch;
  min-height: 190px;
}

.tss-tile-split-half {
  flex: 1 1 50%;
}

.tss-tile-split-half .tss-tile-title {
  white-space: normal;
  overflow: visible;
  text-overflow: clip;
}

/* Let split tile description show fully (still constrained by min-height) */
.tss-tile-split-half .tss-tile-desc {
  display: block;
  -webkit-line-clamp: initial;
  -webkit-box-orient: initial;
}

.tss-tile-split-half:focus,
.tss-tile-split-half:focus-visible {
  outline: 2px solid #111;
  outline-offset: -2px;
}

@media (min-width: 768px) {
  .tss-home {
    padding-top: 55px;
    padding-bottom: 40px;
  }
}

