/* OED Frontend - Base Layout & Structure
   Theme-agnostic foundation - works without any theme loaded
   ============================================ */

/* ============================================
   CSS Custom Properties (Neutral Defaults)
   These can be overridden by theme files
   ============================================ */
:root {
  /* Colors - Neutral defaults */
  --color-bg: #f5f5f5;
  --color-surface: #ffffff;
  --color-text: #333333;
  --color-text-muted: #666666;
  --color-border: #cccccc;
  --color-border-focus: #666666;
  --color-accent: #444444;
  --color-accent-hover: #222222;

  /* Typography - System defaults */
  --font-display: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-body: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-size-base: 16px;
  --font-size-sm: 14px;
  --font-size-lg: 18px;
  --font-size-xl: 24px;
  --font-size-2xl: 32px;

  /* Spacing */
  --spacing-xs: 4px;
  --spacing-sm: 8px;
  --spacing-md: 16px;
  --spacing-lg: 24px;
  --spacing-xl: 32px;
  --spacing-2xl: 48px;

  /* Border radius */
  --radius-sm: 3px;
  --radius-md: 4px;

  /* Shadows - Neutral defaults */
  --shadow-inset: inset 0 1px 2px rgba(0,0,0,0.1);
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.1);
  --shadow-md: 0 2px 6px rgba(0,0,0,0.15);
}

/* ============================================
   Reset / Normalize
   ============================================ */
*, *::before, *::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  padding: var(--spacing-lg) var(--spacing-xl);
  font-family: var(--font-body);
  font-size: var(--font-size-base);
  line-height: 1.5;
  color: var(--color-text);
  background-color: var(--color-bg);
}

/* ============================================
   Header / Title Area
   ============================================ */
.site-header {
  text-align: center;
  margin-bottom: var(--spacing-lg);
}

.site-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: var(--font-2xl, 2rem);
  font-weight: 700;
  color: var(--color-text);
}

.site-tagline {
  margin: var(--spacing-sm) 0 0;
  font-family: var(--font-body);
  font-size: var(--font-size-sm);
  color: var(--color-text-muted);
}

/* Legacy h1 support */
h1 {
  margin: var(--spacing-lg) 0;
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 700;
}

/* ============================================
   Layout Containers
   ============================================ */
.control-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: var(--spacing-lg);
  margin-bottom: var(--spacing-md);
  padding: var(--spacing-sm) 0;
}

.control-group {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
}

.control-group label {
  font-size: var(--font-size-sm);
  color: var(--color-text-muted);
}

.control-section {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-xs);
}

.section-label {
  font-size: var(--font-size-sm);
  font-weight: 500;
  color: var(--color-text);
}

.section-label.muted {
  color: var(--color-text-muted);
  font-weight: 400;
}

.jump-section {
  opacity: 0.7;
  transition: opacity 0.2s ease;
}

.jump-section:hover,
.jump-section:focus-within {
  opacity: 1;
}

/* ============================================
   Viewer Container
   ============================================ */
.viewer-container {
  width: 100%;
}

.viewer-container iframe {
  display: block;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface);
}

/* ============================================
   Form Controls (Dropdowns, Inputs)
   ============================================ */
select,
input[type="text"] {
  padding: var(--spacing-sm);
  font-family: var(--font-body);
  font-size: var(--font-size-sm);
  color: var(--color-text);
  background-color: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

select:focus,
input[type="text"]:focus {
  border-color: var(--color-border-focus);
}

select {
  cursor: pointer;
  min-width: 120px;
}

input[type="text"] {
  min-width: 200px;
}

/* ============================================
   Page Slider
   ============================================ */
.page-slider-wrapper {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
}

input[type="range"] {
  width: 150px;
  height: 6px;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
  background: var(--color-border);
  border-radius: 3px;
  outline: none;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--color-accent);
  cursor: pointer;
  border: none;
}

input[type="range"]::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--color-accent);
  cursor: pointer;
  border: none;
}

input[type="range"]:focus::-webkit-slider-thumb {
  box-shadow: 0 0 0 3px rgba(68, 68, 68, 0.2);
}

input[type="range"]:focus::-moz-range-thumb {
  box-shadow: 0 0 0 3px rgba(68, 68, 68, 0.2);
}

.page-display {
  min-width: 40px;
  font-family: var(--font-body);
  font-size: var(--font-size-sm);
  color: var(--color-text-muted);
  text-align: right;
}

/* ============================================
   Search / Autocomplete
   ============================================ */
.search-wrapper {
  position: relative;
}

.autocomplete-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  margin: 0;
  padding: 0;
  list-style: none;
  background-color: var(--color-surface);
  border: 1px solid var(--color-border);
  border-top: none;
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
  max-height: 200px;
  overflow-y: auto;
  z-index: 100;
}

.autocomplete-dropdown[hidden] {
  display: none;
}

.autocomplete-item {
  padding: var(--spacing-sm) var(--spacing-md);
  cursor: pointer;
  border-bottom: 1px solid var(--color-border);
  transition: background-color 0.1s ease;
}

.autocomplete-item:last-child {
  border-bottom: none;
}

.autocomplete-item:hover,
.autocomplete-item.selected {
  background-color: var(--color-bg);
}

/* ============================================
   Utility Classes
   ============================================ */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
