/* 
 * AI Summary: Stylesheet for paper landing page. Contains styling for the academic paper layout,
 * responsive design elements, interactive components (lightbox, collapsible sections), and theme variables.
 */

:root {
  /* Main color palette - more modern and cohesive */
  --primary-color: #2563eb;          /* Blue 600 */
  --primary-light: #93c5fd;          /* Blue 300 */
  --primary-dark: #1e40af;           /* Blue 800 */
  --secondary-color: #1e293b;        /* Slate 800 */
  --accent-color: #f97316;           /* Orange 500 */
  --accent-light: #fdba74;           /* Orange 300 */
  --accent-dark: #c2410c;            /* Orange 700 */

  /* Background and text colors */
  --light-bg: #f8fafc;               /* Slate 50 */
  --dark-bg: #1e293b;                /* Slate 800 */
  --card-bg: #ffffff;                /* White */
  --text-color: #334155;             /* Slate 600 */
  --light-text: #f8fafc;             /* Slate 50 */
  --muted-text: #64748b;             /* Slate 500 */
  --heading-color: #0f172a;          /* Slate 900 */

  /* UI element colors */
  --border-color: #e2e8f0;           /* Slate 200 */
  --code-bg: #f1f5f9;                /* Slate 100 */
  --blockquote-bg: #eff6ff;          /* Blue 50 */
  --blockquote-border: #3b82f6;      /* Blue 500 */
  --highlight-bg: #fef3c7;           /* Amber 100 */
  --header-gradient-start: #1e40af;  /* Blue 800 */
  --header-gradient-end: #3b82f6;    /* Blue 500 */

  /* Spacing */
  --spacing-xs: 0.25rem;
  --spacing-sm: 0.5rem;
  --spacing-md: 1rem;
  --spacing-lg: 1.5rem;
  --spacing-xl: 2rem;
  --spacing-2xl: 3rem;

  /* Shadows */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);

  /* Transitions */
  --transition-fast: 150ms ease;
  --transition-normal: 250ms ease;
  --transition-slow: 350ms ease;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji";
  line-height: 1.7;
  color: var(--text-color);
  background-color: var(--light-bg);
  max-width: 1200px;
  margin: 0 auto;
  padding: var(--spacing-lg);
  font-size: 1.05rem;
}

a {
  color: var(--primary-color);
  text-decoration: none;
  transition: color var(--transition-fast);
  font-weight: 500;
}

a:hover {
  color: var(--primary-dark);
  text-decoration: underline;
}

h1,
h2,
h3,
h4,
h5,
h6 {
  margin: 1.8rem 0 1rem;
  line-height: 1.2;
  color: var(--heading-color);
  font-weight: 700;
  letter-spacing: -0.01em;
}

h1 {
  font-size: 2.6rem;
  margin-top: 0;
  margin-bottom: 0.8rem;
  letter-spacing: -0.02em;
  background: linear-gradient(to right, var(--primary-dark), var(--primary-color));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  display: inline-block;
  padding-bottom: 0.3rem;
  font-weight: 800;
}

h2 {
  font-size: 1.9rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border-color);
  margin-top: 2.5rem;
}

h3 {
  font-size: 1.5rem;
  color: var(--secondary-color);
  position: relative;
  padding-left: 1rem;
}

h3::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.4rem;
  height: 1.5rem;
  width: 4px;
  background-color: var(--primary-color);
  border-radius: 2px;
}

h4 {
  font-size: 1.25rem;
  color: var(--muted-text);
}

p,
ul,
ol {
  margin-bottom: 1.4rem;
}

strong {
  color: var(--heading-color);
}

ul,
ol {
  padding-left: 1.5rem;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
  margin: 2rem auto;
  border-radius: 8px;
  box-shadow: var(--shadow-md);
  transition: transform var(--transition-normal), box-shadow var(--transition-normal);
  cursor: pointer; /* Show pointer cursor to indicate clickability */
}

img:hover {
  transform: scale(1.02);
  box-shadow: var(--shadow-lg);
}

.caption {
  text-align: center;
  margin-top: -1rem;
  margin-bottom: 2rem;
  font-style: italic;
  color: var(--muted-text);
  font-size: 0.92rem;
  padding: 0 var(--spacing-lg);
}

code {
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo,
    monospace;
  background: var(--code-bg);
  padding: 0.2em 0.4em;
  border-radius: 4px;
  font-size: 0.9em;
  color: var(--primary-dark);
}

pre {
  background: var(--code-bg);
  padding: 1rem;
  overflow-x: auto;
  border-radius: 5px;
  margin-bottom: 1.5rem;
}

pre code {
  background: none;
  padding: 0;
}

blockquote {
  background-color: var(--blockquote-bg);
  border-left: 4px solid var(--blockquote-border);
  padding: 1.5rem 1.75rem;
  margin: 2.5rem 0;
  border-radius: 0 12px 12px 0;
  box-shadow: var(--shadow-md);
  position: relative;
}

blockquote::before {
  content: """;
  position: absolute;
  top: -0.5rem;
  left: 0.5rem;
  font-size: 4rem;
  color: var(--primary-light);
  line-height: 1;
  opacity: 0.3;
}

blockquote p:last-child {
  margin-bottom: 0;
}

.header {
  text-align: center;
  margin-bottom: 3.5rem;
  padding: 2.5rem 1.5rem;
  background: linear-gradient(135deg, var(--light-bg) 0%, var(--primary-light) 100%);
  border-radius: 16px;
  box-shadow: var(--shadow-lg);
  position: relative;
  overflow: hidden;
}

.header::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 6px;
  background: linear-gradient(to right, var(--primary-dark), var(--accent-color));
  border-radius: 16px 16px 0 0;
}

.authors {
  margin: 1.25rem 0;
  font-size: 1.15rem;
  line-height: 1.8;
}

.affiliations {
  font-size: 0.95rem;
  margin-bottom: 1.25rem;
  color: var(--muted-text);
  background-color: rgba(255, 255, 255, 0.7);
  padding: 1rem 1.5rem;
  border-radius: 8px;
  display: inline-block;
}

.conference {
  font-weight: 700;
  margin: 1.5rem 0;
  color: var(--accent-color);
  padding: 0.5rem 1rem;
  background-color: rgba(255, 255, 255, 0.8);
  border-radius: 6px;
  display: inline-block;
}

.resources {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
  margin: 1.75rem 0 0.75rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.75rem 1.5rem;
  background-color: var(--primary-color);
  color: white;
  border-radius: 8px;
  text-decoration: none;
  font-weight: 600;
  transition: all var(--transition-normal);
  border: none;
  box-shadow: var(--shadow-md);
  position: relative;
  overflow: hidden;
}

.btn::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(255, 255, 255, 0.1);
  transform: translateY(100%);
  transition: transform var(--transition-fast);
  z-index: 1;
}

.btn span {
  position: relative;
  z-index: 2;
}

.btn:hover {
  background-color: var(--primary-dark);
  text-decoration: none;
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg);
}

.btn:hover::after {
  transform: translateY(0);
}

.btn:active {
  transform: translateY(-1px);
}

.tldr {
  background-color: var(--card-bg);
  padding: 2rem;
  border-radius: 12px;
  margin: 2.5rem 0;
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-lg);
  position: relative;
  overflow: hidden;
}

.tldr::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 6px;
  background: linear-gradient(to right, var(--primary-color), var(--accent-color));
}

.tldr h3 {
  margin-top: 0;
  color: var(--primary-color);
  font-size: 1.5rem;
  margin-bottom: 1.25rem;
  padding-left: 0;
}

.tldr h3::before {
  display: none;
}

.citation {
  background-color: var(--code-bg);
  padding: 2rem;
  border-radius: 12px;
  margin: 2.5rem 0;
  border: 1px solid var(--border-color);
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo,
    monospace;
  white-space: pre-wrap;
  font-size: 0.9rem;
  position: relative; /* For positioning the copy button */
  overflow-x: auto; /* For horizontal scrolling if needed */
  box-shadow: var(--shadow-md);
  line-height: 1.6;
}

/* Style for the copy button */
.copy-btn {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  background-color: var(--card-bg);
  color: var(--primary-color);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  opacity: 0.9;
  transition: all var(--transition-fast);
}

.copy-btn:hover {
  opacity: 1;
  color: var(--primary-dark);
  background-color: var(--light-bg);
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm);
}

.copy-btn:active {
  transform: translateY(0);
}

.copy-btn.copied {
  background-color: var(--primary-color);
  color: white;
}

.copy-btn svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  fill: none;
}

table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.5rem 0;
}

table th,
table td {
  padding: 0.75rem;
  text-align: left;
  border: 1px solid var(--border-color);
}

table th {
  background-color: var(--light-bg);
  font-weight: 600;
}

table tr:nth-child(even) {
  background-color: var(--light-bg);
}

.two-column {
  display: flex;
  gap: 2rem;
  margin: 1.5rem 0;
}

.two-column > div {
  flex: 1;
}

.highlight {
  background-color: var(--highlight-bg);
  padding: 2rem;
  border-radius: 12px;
  margin: 2.5rem 0;
  box-shadow: var(--shadow-md);
  position: relative;
}

.highlight::before {
  content: "";
  position: absolute;
  top: -10px;
  right: 30px;
  width: 22px;
  height: 22px;
  background-color: var(--accent-color);
  border-radius: 50%;
  opacity: 0.15;
}

.highlight::after {
  content: "";
  position: absolute;
  bottom: -15px;
  left: 40px;
  width: 36px;
  height: 36px;
  background-color: var(--primary-color);
  border-radius: 50%;
  opacity: 0.1;
}

.highlight h3 {
  color: var(--primary-dark);
  margin-top: 0;
  border-bottom: 1px solid var(--accent-light);
  padding-bottom: 0.75rem;
  margin-bottom: 1.25rem;
  padding-left: 0;
}

.highlight h3::before {
  display: none;
}

@media (max-width: 768px) {
  .two-column {
    flex-direction: column;
  }
}

footer {
  margin-top: 4rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border-color);
  text-align: center;
  font-size: 0.95rem;
  color: var(--muted-text);
}

footer a {
  color: var(--primary-color);
}

footer p {
  margin-bottom: 1rem;
}

.responsive-img {
  width: 100%;
  display: block;
  margin: auto;
  margin-bottom: 1.5em;
}

.responsive-img-large {
  width: 100%;
  display: block;
  margin: auto;
  margin-bottom: 1.5em;
}

/* Lightbox styles */
.lightbox {
  display: none;
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.85);
  opacity: 0;
  transition: opacity 0.3s ease;
  justify-content: center;
  align-items: center;
  overflow: hidden;
}

.lightbox.active {
  display: flex;
  opacity: 1;
}

.lightbox-content {
  max-width: 90%;
  max-height: 90%;
  border-radius: 4px;
  box-shadow: var(--shadow-xl);
  position: relative;
  transform: scale(0.95);
  transition: transform 0.3s ease;
}

.lightbox.active .lightbox-content {
  transform: scale(1);
}

.lightbox-close {
  position: absolute;
  top: 15px;
  right: 15px;
  color: white;
  font-size: 24px;
  background-color: rgba(0, 0, 0, 0.5);
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  transition: background-color 0.2s ease;
}

.lightbox-close:hover {
  background-color: rgba(0, 0, 0, 0.8);
}

.back-to-top {
  position: fixed;
  bottom: 20px;
  right: 20px;
  background-color: var(--primary-color);
  color: white;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  display: flex;
  justify-content: center;
  align-items: center;
  text-decoration: none;
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.3s ease, transform 0.3s ease, background-color 0.2s ease;
  box-shadow: var(--shadow-md);
  pointer-events: none;
  z-index: 100;
  -webkit-tap-highlight-color: transparent; /* Remove tap highlight on mobile */
}

.back-to-top.visible {
  opacity: 0.9;
  transform: translateY(0);
  pointer-events: auto;
}

.back-to-top:hover {
  background-color: var(--primary-dark);
  opacity: 1;
  text-decoration: none;
}

.back-to-top:focus {
  outline: 2px solid var(--primary-light);
  outline-offset: 2px;
}

/* Reset active state specifically for the back-to-top button */
.back-to-top-active {
  background-color: var(--primary-dark) !important;
}

/* Ensure no persistent hover effects on touch devices */
@media (hover: none) {
  .back-to-top:hover, .back-to-top:active {
    background-color: var(--primary-color);
  }

  .back-to-top-active {
    background-color: var(--primary-dark) !important;
  }
}

/* Collapsible supplementary information styles */
.collapsible-details {
  margin: 2rem 0;
  border: 1px solid var(--border-color);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: var(--shadow-md);
}

.collapsible {
  background-color: var(--light-bg);
  color: var(--primary-color);
  cursor: pointer;
  padding: 1rem 1.5rem;
  width: 100%;
  text-align: left;
  border: none;
  outline: none;
  font-size: 1.05rem;
  font-weight: 600;
  transition: all var(--transition-normal);
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-radius: 12px;
}

.collapsible:hover, .collapsible:focus {
  background-color: var(--primary-light);
  color: var(--primary-dark);
}

.collapsible:focus {
  outline: 2px solid var(--primary-light);
  outline-offset: 2px;
}

.collapsible-icon {
  transition: transform var(--transition-normal);
}

.collapsible[aria-expanded="true"] .collapsible-icon {
  transform: rotate(180deg);
}

.hide-text {
  display: none;
}

.collapsible[aria-expanded="true"] .show-text {
  display: none;
}

.collapsible[aria-expanded="true"] .hide-text {
  display: inline;
}

.content {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.6s ease;
  background-color: var(--card-bg);
}

.arch-figure-container {
  padding: 1.5rem;
}

.arch-figure-section {
  margin-bottom: 2rem;
}

.arch-explanation {
  background-color: var(--light-bg);
  padding: 1.5rem;
  border-radius: 8px;
  margin-top: 1.5rem;
}

.arch-explanation p {
  margin-bottom: 1rem;
}

.arch-explanation ul {
  margin-bottom: 1rem;
  padding-left: 2rem;
}

/* On screens wider than 768px (typical tablet/laptop breakpoint) */
@media (min-width: 768px) {
  .responsive-img {
    width: 50%;
  }
  .responsive-img-large {
    width: 90%;
  }

  .arch-figure-container {
    padding: 2rem;
  }
}
