/* ==========================================================================
   EXPERIMENTAL BRUTALIST ARCHIVE - DRAGGABLE MULTI-TAB ENGINE
   ========================================================================== */

/* Design Tokens & Theme Variables */
:root {
  --bg: #e7e7e7;
  --black: #111111;
  --white: #ffffff;
  --yellow: #ded338;
  --red: #b72d2b;
  --gray: #cfcfcf;
  
  --font-sans: Arial, Helvetica, sans-serif;
  --font-mono: 'IBM Plex Mono', monospace;
  
  --border-color: var(--black);
  --border-width: 1.5px;
  --color-grid: rgba(17, 17, 17, 0.05);
}

/* Theme Options */

.theme-punk {
  --bg: #120136;
  --black: #00ffff;
  --white: #200543;
  --yellow: #ff007f;
  --red: #ff007f;
  --gray: #15002b;
  --color-grid: rgba(3, 198, 255, 0.07);
}

.theme-mono {
  --bg: #ffffff;
  --black: #000000;
  --white: #ffffff;
  --yellow: #7f7f7f;
  --red: #000000;
  --gray: #eeeeee;
  --color-grid: rgba(0, 0, 0, 0.05);
}

/* Reset and Core Viewport Frame */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  user-select: none;
}

body {
  background-color: var(--black);
  color: var(--black);
  font-family: var(--font-sans);
  font-size: 13px;
  line-height: 1.3;
  width: 100vw;
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  transition: background-color 0.3s ease, color 0.3s ease;
}

/* Outer Presentation Frame Margins */
.viewport-frame {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: var(--black);
}

/* Center Editorial Collage Canvas Stage */
.canvas-stage {
  position: relative;
  width: 100vw;
  height: 100vh;
  background-color: var(--bg);
  overflow: hidden;
  z-index: 0;
  transition: background-color 0.3s ease;
}

/* Grid Overlay Background */
.desktop-grid {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-size: 30px 30px;
  background-image: 
    linear-gradient(to right, var(--color-grid) 1px, transparent 1px),
    linear-gradient(to bottom, var(--color-grid) 1px, transparent 1px);
  z-index: 1;
  pointer-events: none;
}

.desktop-grid.disabled {
  display: none;
}

/* Marquee Header */
.panel-ticker {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 24px;
  white-space: nowrap;
  overflow: hidden;
  font-size: 11px;
  font-family: var(--font-mono);
  display: flex;
  align-items: center;
  background-color: var(--white);
  z-index: 2;
}

.border-bottom-brutal {
  border-bottom: var(--border-width) solid var(--black);
}

.ticker-text {
  display: inline-block;
  white-space: nowrap;
  animation: panel-marquee 30s linear infinite;
  color: var(--black);
}

@keyframes panel-marquee {
  0% { transform: translate3d(0, 0, 0); }
  100% { transform: translate3d(-50%, 0, 0); }
}

/* Window Shell System (Draggable Tabs) */
.brutal-window {
  position: absolute;
  background-color: var(--white);
  border: var(--border-width) solid var(--black);
  z-index: 10;
  display: flex;
  flex-direction: column;
  box-shadow: 4px 4px 0px rgba(0, 0, 0, 0.15);
  overflow: hidden;
  transition: box-shadow 0.15s ease, border-color 0.15s ease;
  opacity: 0.98;
}

.brutal-window.active {
  z-index: 100;
  opacity: 1;
  box-shadow: 6px 6px 0px var(--black);
}

/* Window Chrome/Header bar */
.window-bar {
  height: 24px;
  border-bottom: var(--border-width) solid var(--black);
  display: flex;
  align-items: center;
  padding: 0 10px;
  background-color: var(--white);
  user-select: none;
  cursor: move;
}

.brutal-window.active .window-bar {
  background-color: var(--bg);
}

.window-dot {
  width: 6px;
  height: 6px;
  border: 0.8px solid var(--black);
  border-radius: 50%;
  margin-right: 5px;
  background-color: transparent;
}

.brutal-window.active .window-dot:nth-child(1) { background-color: var(--red); }
.brutal-window.active .window-dot:nth-child(2) { background-color: var(--yellow); }
.brutal-window.active .window-dot:nth-child(3) { background-color: var(--black); }

.window-title-style {
  font-style: italic;
  font-weight: bold;
  font-size: 13px;
  margin-left: 6px;
  margin-right: 4px;
  letter-spacing: -0.5px;
}

.window-title {
  font-size: 11px;
  font-family: var(--font-mono);
  color: #7f7f7f;
}

.brutal-window.active .window-title {
  color: var(--black);
  font-weight: bold;
}

/* Window Content Grid */
.window-content {
  padding: 14px 12px;
  height: calc(100% - 24px);
  overflow-y: auto;
}

.archive-grid {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 16px;
}

.archive-col {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.archive-col h3 {
  font-size: 14px;
  font-weight: normal;
  text-transform: uppercase;
  margin-bottom: 10px;
  border-bottom: var(--border-width) solid var(--black);
  padding-bottom: 3px;
  letter-spacing: 0.5px;
}

.archive-list {
  list-style: none;
}

.archive-list li {
  font-size: 11px;
  line-height: 1.35;
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--black);
}

.archive-item {
  cursor: pointer;
  transition: color 0.1s ease;
  position: relative;
}

.archive-item:hover {
  color: var(--red);
  font-weight: bold;
  text-decoration: underline;
}

.archive-list.categories li {
  color: #666666;
}

.info-p {
  font-size: 11px;
  line-height: 1.3;
  margin-bottom: 8px;
  text-align: justify;
}

.text-muted {
  color: #7a7a7a;
}

.contact-details {
  font-size: 11px;
  line-height: 1.4;
}

.contact-link {
  color: var(--black);
  text-decoration: underline;
  cursor: pointer;
}

.contact-link:hover {
  color: var(--red);
}

.redact-text {
  background-color: var(--black);
  color: var(--black);
  padding: 0 3px;
  font-family: var(--font-mono);
  font-size: 10px;
  position: relative;
  cursor: help;
  transition: color 0.1s ease;
}

.redact-text:hover {
  color: var(--white);
}

.theme-punk .redact-text:hover { color: #000; }

.redact-text::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: 125%;
  left: 50%;
  transform: translateX(-50%);
  background-color: var(--black);
  color: var(--bg);
  padding: 4px 6px;
  font-size: 8px;
  white-space: nowrap;
  z-index: 10000;
  display: none;
  border: 1px solid var(--black);
}

.redact-text:hover::after {
  display: block;
}

.redaction-status-box {
  background-color: var(--gray);
  line-height: 1.6;
  font-size: 10px;
}

.border-brutal {
  border: var(--border-width) solid var(--black);
}

/* Control Panel styles */
.pref-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  cursor: pointer;
}

.pref-label input[type="checkbox"] {
  accent-color: var(--black);
  cursor: pointer;
}

.palette-switches {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  margin-top: 6px;
}

.palette-btn {
  padding: 5px 2px;
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 10px;
  text-transform: uppercase;
  background-color: var(--white);
  color: var(--black);
  border: var(--border-width) solid var(--black);
  cursor: pointer;
  transition: all 0.1s ease;
}

.palette-btn:hover {
  background-color: var(--black);
  color: var(--white);
}

.palette-btn.active {
  background-color: var(--black) !important;
  color: var(--bg) !important;
}

/* Hover Preview Cards */
.hover-preview-card {
  position: fixed;
  background-color: var(--white);
  border: var(--border-width) solid var(--black);
  padding: 6px 10px;
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--black);
  z-index: 10000;
  pointer-events: none;
  box-shadow: 3px 3px 0px var(--black);
  max-width: 250px;
  white-space: pre-wrap;
  line-height: 1.3;
}

/* Interactive Cursor Label follow-mouse */
.cursor-label {
  position: fixed;
  z-index: 999999;
  pointer-events: none;
  font-family: var(--font-mono);
  font-size: 9px;
  color: var(--black);
  background-color: var(--yellow);
  padding: 1px 4px;
  border: var(--border-width) solid var(--black);
  white-space: nowrap;
  display: block;
}


/* Exploding Borderless Image Component */
.interactive-image-wrapper {
  cursor: pointer;
  overflow: visible;
}

.borderless-img {
  border: none !important;
  box-shadow: none !important;
  background: transparent !important;
}

.borderless-img img {
  border: none !important;
  box-shadow: none !important;
  background: transparent !important;
}

.explodable-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.interactive-image-wrapper canvas {
  position: absolute;
  top: -100%;
  left: -100%;
  width: 300%;
  height: 300%;
  pointer-events: none;
  z-index: 9;
}

/* Theme Switcher Dots */
.theme-dot {
  transition: transform 0.12s cubic-bezier(0.175, 0.885, 0.32, 1.275), box-shadow 0.12s ease;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
  width: 8px;
}

::-webkit-scrollbar-track {
  background: var(--white);
  border-left: var(--border-width) solid var(--black);
}

::-webkit-scrollbar-thumb {
  background: var(--gray);
  border: var(--border-width) solid var(--black);
}

::-webkit-scrollbar-thumb:hover {
  background: var(--red);
}

/* Utility classes */
.flex { display: flex; }
.justify-between { justify-content: space-between; }
.flex-wrap { flex-wrap: wrap; }
.gap-2 { gap: 8px; }
.mb-2 { margin-bottom: 8px; }
.mb-4 { margin-bottom: 16px; }
.mt-4 { margin-top: 16px; }
.mt-6 { margin-top: 24px; }
.p-2 { padding: 8px; }
.space-y-2 > * + * { margin-top: 8px; }
.text-center { text-align: center; }

/* Info Grid Component */
.info-grid {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 14px;
}

/* Responsive adjustments */
@media (max-width: 900px) {
  body {
    overflow-y: auto !important;
    overflow-x: hidden !important;
    height: auto !important;
    width: 100% !important;
    position: relative !important;
  }

  .viewport-frame {
    padding: 0;
    overflow: visible !important;
    height: auto !important;
    min-height: 100vh;
    display: block;
  }
  
  .canvas-stage {
    aspect-ratio: auto;
    height: auto !important;
    min-height: 100vh;
    border: none;
    max-width: 100%;
    max-height: none;
    padding: 40px 10px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    overflow: visible !important;
  }

  .brutal-window {
    position: relative !important;
    left: auto !important;
    top: auto !important;
    width: 100% !important;
    height: auto !important;
    min-height: 200px;
    margin: 0 auto;
    box-shadow: 4px 4px 0px var(--black);
  }

  .window-content {
    height: auto;
    overflow-y: visible;
  }
  
  .panel-ticker {
    position: relative;
    margin-bottom: 20px;
  }
  
  .cursor-label {
    display: none !important;
  }

  /* Responsive Collage Grid at the bottom of the page */
  .collage-container {
    display: grid !important;
    grid-template-columns: repeat(3, 1fr) !important;
    gap: 10px !important;
    padding: 16px !important;
    background-color: var(--white) !important;
    border: var(--border-width) solid var(--black) !important;
    box-shadow: 4px 4px 0px var(--black) !important;
    margin-top: 10px !important;
    width: 100% !important;
    z-index: 10 !important;
  }

  .interactive-image-wrapper {
    position: relative !important;
    left: auto !important;
    right: auto !important;
    top: auto !important;
    bottom: auto !important;
    width: 100% !important;
    aspect-ratio: 1 / 1 !important;
    height: auto !important;
    transform: none !important;
  }
  
  .info-grid {
    grid-template-columns: 1fr !important;
    gap: 16px !important;
  }
}

@media (max-width: 600px) {
  .archive-grid {
    grid-template-columns: 1fr !important;
    gap: 12px !important;
  }
  
  .collage-container {
    grid-template-columns: repeat(2, 1fr) !important; /* 2 columns on narrow viewports for better detail */
  }
}
