@import url('https://fonts.googleapis.com/css2?family=Alegreya+SC:ital,wght@0,400;0,500;0,700;0,800;0,900;1,400;1,500;1,700;1,800;1,900&family=Alegreya+Sans+SC:ital,wght@0,100;0,300;0,400;0,500;0,700;0,800;0,900;1,100;1,300;1,400;1,500;1,700;1,800;1,900&family=Alegreya+Sans:ital,wght@0,100;0,300;0,400;0,500;0,700;0,800;0,900;1,100;1,300;1,400;1,500;1,700;1,800;1,900&family=Alegreya:ital,wght@0,400..900;1,400..900&display=swap');

/* CSS Custom Properties */
:root {
  /* Color System */
  --color-primary: #db7992;
  --color-primary-light: rgba(219, 121, 146, 0.15);
  --color-text-primary: #333;
  --color-text-secondary: #666;
  --color-text-muted: #888;
  --color-text-heading: #1a1a1a;
  --color-text-author: #000;

  /* Background Colors */
  --color-bg-body: #f4f4f4;
  --color-bg-container: #fff;
  --color-bg-section: #f2f2f2;
  --color-bg-error: #ffeaea;

  /* Borders & Shadows */
  --color-border: #ddd;
  --color-border-error: #fab1a0;
  --color-error: #d63031;
  --shadow: 0 4px 6px rgba(0, 0, 0, 0.1);

  /* Accent colors */
  --accent-blue: #5e81ac;
  --accent-green: #a3be8c;
  --accent-yellow: #ebcb8b;
  --accent-red: #bf616a;

  /* Spacing */
  --space-xs: 0.5rem;
  --space-sm: 1rem;
  --space-md: 1.5rem;
  --space-lg: 2rem;

  /* Border Radius */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;

  /* Typography */
  --font-family-base: 'Alegreya Sans', 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --font-family-serif: 'Alegreya', serif;
  --font-family-mono: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
  --font-size-base: 1.2em;
}

/* Base Styles */
*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  font-family: var(--font-family-base);
  line-height: 1.6;
  margin: 0;
  padding: var(--space-lg);
  font-size: var(--font-size-base);
  color: var(--color-text-primary);
  background-color: var(--color-bg-body);
}

/* Layout */
.container {
  max-width: 800px;
  width: 90%;
  margin: 0 auto;
  background: var(--color-bg-container);
  padding: var(--space-lg);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}

/* Typography */
pre {
  border-radius: var(--radius-sm);
  overflow-x: auto;
}

pre code {
  font-family: var(--font-family-mono);
  font-size: 0.8em;
  line-height: 1.4;
  white-space: pre;
}

.paper-title {
  color: var(--color-text-heading);
  text-align: center;
  font-size: clamp(1.8rem, 4vw, 2.5rem);
  font-weight: 450;
  margin-bottom: var(--space-xs);
  font-family: var(--font-family-serif);
}

.authors {
  text-align: center;
  /* font-weight: bold; */
  font-size: 1.1em;
  color: var(--color-text-author);
  margin-bottom: var(--space-lg);
}

.authors a {
  color: var(--color-text-author);
  /* background-color: var(--color-primary-light); */
  text-decoration: none;
  /* transition: all 0.3s ease; */
  /* border: 2px solid transparent; */
  /* border-radius: var(--radius-sm); */
  /* padding: var(--space-xs) var(--space-sm); */
}

.authors a:hover,
.authors a:focus-visible {
  /* background-color: var(--color-primary); */
  border-bottom: 2px solid var(--accent-blue);
  /* color: white; */
}

.section-heading {
  border-bottom: 2px solid var(--color-border);
  padding-bottom: var(--space-xs);
  margin-block: var(--space-lg) var(--space-sm);
  color: var(--color-text-secondary);
}

/* Font family utilities */
.sc-serif {
  font-family: 'Alegreya SC', serif;
}

.sc-sans {
  font-family: 'Alegreya Sans SC', sans-serif;
}

/* ============================================
   CONTENT SECTIONS
   ============================================ */
.abstract {
  background-color: var(--abstract-background);
  padding: 1.5em;
  margin-bottom: 2em;
  border-radius: 12px;
}

/* Abstract Dropdown Section */
.abstract-section {
  margin: var(--space-lg) 0;
}

.abstract-details {
  background-color: var(--color-bg-section);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  overflow: hidden;
  transition: all 0.3s ease;
}

.abstract-details[open] {
  box-shadow: var(--shadow);
}

.abstract-summary {
  background-color: var(--color-bg-container);
  padding: var(--space-md);
  cursor: pointer;
  font-size: 1.1em;
  font-weight: 500;
  color: var(--color-text-secondary);
  border: none;
  outline: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: all 0.3s ease;
  user-select: none;
}

.abstract-summary:hover {
  background-color: var(--color-primary-light);
  color: var(--color-primary);
}

.abstract-summary:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

.abstract-summary::after {
  content: '▶';
  font-size: 0.8em;
  transition: transform 0.3s ease;
  margin-left: auto;
}

.abstract-details[open] .abstract-summary::after {
  transform: rotate(90deg);
}

.abstract-content {
  padding: 0 var(--space-md) var(--space-md) var(--space-md);
  font-family: var(--font-family-serif);
  line-height: 1.7;
  color: var(--color-text-primary);
}

.abstract-content p {
  margin-bottom: var(--space-md);
}

.abstract-content p:last-child {
  margin-bottom: 0;
}

/* ============================================
   FIGURES
   ============================================ */
.figure {
  text-align: center;
  margin: 2em 0;
}

.figure img {
  width: 100%;
  max-width: 100%;
  height: auto;
  border-radius: 12px;
  box-shadow: 0 4px 6px var(--shadow-color);
}

.figure-caption {
  font-size: 0.9em;
  color: var(--secondary-text);
  margin-top: 0.5em;
}

/* ============================================
   LINKS AND NAVIGATION
   ============================================ */
.links {
  text-align: center;
  margin-bottom: var(--space-lg);
}

.links a {
  color: var(--color-primary);
  text-decoration: none;
  margin-inline-end: var(--space-md);
  padding: var(--space-xs) var(--space-sm);
  border-radius: var(--radius-sm);
  background-color: var(--color-primary-light);
  transition: all 0.3s ease;
  display: inline-block;
}

.links a:hover,
.links a:focus-visible {
  background-color: var(--color-primary);
  color: white;
  transform: translateY(-1px);
  box-shadow: var(--shadow);
}

/* ============================================
   DEMO SECTION
   ============================================ */
.demo-video {
  width: 100%;
  height: auto;
  border-radius: var(--radius-md);
  margin: var(--space-md) 0;
  box-shadow: var(--shadow);
}
.demo .input-group,
.demo .form-group {
  margin-bottom: var(--space-md);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.demo textarea {
  width: 100%;
  min-height: 120px;
  padding: 0.75em;
  border: 2px solid var(--color-border);
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 1em;
  line-height: 1.4;
  resize: vertical;
  transition: border-color 0.3s ease;
}

.demo textarea:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px var(--color-primary-light);
}

.input-caption {
  display: block;
  color: var(--color-text-muted);
  font-size: 0.85em;
  margin-top: var(--space-xs);
  line-height: 1.4;
}

.demo button {
  background-color: var(--color-primary-light);
  color: var(--color-primary);
  border: 2px solid transparent;
  padding: 0.75em 2em;
  border-radius: var(--radius-sm);
  font-size: 1em;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s ease;
}

.demo button:hover:not(:disabled),
.demo button:focus-visible:not(:disabled) {
  background-color: var(--color-primary);
  color: white;
  transform: translateY(-1px);
  box-shadow: var(--shadow);
}

.demo button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.demo select {
  padding: 0.75em;
  border: 2px solid var(--color-border);
  border-radius: var(--radius-md);
  font-family: inherit;
  font-size: 1em;
  background-color: var(--color-bg-container);
  box-shadow: var(--shadow);
  transition: all 0.3s ease;
  cursor: pointer;
}

.demo select:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow:
    0 0 0 3px var(--color-primary-light),
    var(--shadow);
}

.demo select:hover {
  border-color: var(--color-primary);
  transform: translateY(-1px);
  box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);
}

.model-and-button {
  display: flex;
  align-items: center;
  gap: 1.5em;
  flex-wrap: wrap;
}

.model-selection {
  display: flex;
  align-items: center;
  gap: 0.5em;
}

.demo .message.error {
  background-color: var(--color-bg-error);
  color: var(--color-error);
  padding: 0.75em;
  border-radius: var(--radius-sm);
  margin: var(--space-sm) 0;
  border: 1px solid var(--color-border-error);
}

.demo .result {
  background-color: var(--color-bg-section);
  padding: var(--space-md);
  border-radius: var(--radius-sm);
  margin-top: var(--space-sm);
  font-family: var(--font-family-serif);
  font-size: 1.1em;
  line-height: 1.6;
}

.demo .result img {
  width: 100%;
  max-width: 100%;
  height: auto;
  border-radius: 12px;
  box-shadow: 0 4px 6px var(--shadow-color);
  margin: 0.5em 0;
}

.result-image {
  width: 100%;
  height: auto;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow);
  margin: var(--space-md) 0;
  display: block;
}

.result-image-narrow {
  width: 75%;
  margin-left: auto;
  margin-right: auto;
}

.image-caption {
  display: block;
  color: var(--color-text-muted);
  font-size: 0.85em;
  text-align: center;
  margin-top: -1em;
  margin-bottom: var(--space-md);
}

/* ============================================
   CITATION
   ============================================ */
.citation-inner {
  background-color: #f8f8f8;
  padding: var(--space-md);
  margin-top: var(--space-md);
  border-radius: var(--radius-md);
  position: relative;
  box-shadow: var(--shadow);
  border: 1px solid var(--color-border);
}

.copy-button {
  position: absolute;
  top: 1em;
  right: 1em;
  /* background-color: var(--link-background); */
  color: var(--link-color);
  border: 1px solid var(--border-color);
  padding: 0.5em 1em;
  border-radius: 6px;
  font-size: 0.9em;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  gap: 0.3em;
}

.copy-button:hover {
  background-color: var(--link-color);
  color: white;
  transform: translateY(-1px);
  box-shadow: 0 2px 4px var(--shadow-color);
}

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

.copy-button.copied {
  background-color: #81c464;
  color: white;
  /* border-color: #81c464; */
}

.citation-inner pre {
  margin: 0;
  padding-right: 6em; /* Make room for copy button */
}

/* ============================================
   FOOTER
   ============================================ */
.footer {
  text-align: center;
  margin-top: 3em;
  font-size: 0.9em;
  color: var(--muted-text);
}

/* Responsive Design */

/* Large screens */
@media (min-width: 1200px) {
  .container {
    width: 70%;
  }
}

/* Mobile and tablet */
@media (max-width: 768px) {
  body {
    padding: var(--space-xs);
  }

  .container {
    padding: var(--space-sm);
    width: calc(100% - 1rem);
    max-width: none;
  }

  .links {
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
    align-items: center;
  }

  .links a {
    margin-inline-end: 0;
    min-width: 150px;
    text-align: center;
  }

  .model-and-button {
    flex-direction: column;
    align-items: stretch;
    gap: var(--space-sm);
  }

  .model-selection {
    justify-content: space-between;
    width: 100%;
  }

  .citation-inner {
    padding: var(--space-xs);
  }

  .copy-button {
    position: relative;
    top: auto;
    right: auto;
    margin-top: var(--space-xs);
    width: 100%;
    justify-content: center;
  }

  .citation-inner pre {
    padding-right: 0;
    overflow-x: auto;
    font-size: 0.8em;
    white-space: pre-wrap;
    word-break: break-all;
  }

  pre,
  pre code {
    font-size: 0.8em;
    word-break: break-all;
    white-space: pre-wrap;
  }
}
