/* Sorajima Images - 100% Landing Parity Design */

@font-face {
  font-family: 'Jacobs';
  src: url('fonts/jacobs-400.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Jacobs';
  src: url('fonts/jacobs-500.woff2') format('woff2');
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Jacobs';
  src: url('fonts/jacobs-600.woff2') format('woff2');
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Jacobs';
  src: url('fonts/jacobs-700.woff2') format('woff2');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Unbounded';
  src: url('fonts/unbounded-cyrillic.woff2') format('woff2');
  font-weight: 400 900;
  font-style: normal;
  font-display: swap;
}

:root, [data-theme="dark"] {
  --bg-page: #141414;
  --bg-surface: #171717;
  --bg-surface-elevated: #1a1a1a;
  --bg-card: #181818;
  --bg-card-hover: #1f1f1f;
  --bg-badge: rgba(255, 255, 255, 0.05);

  --accent: #faa0a0;
  --accent-rgb: 250, 160, 160;
  --accent-hover: #ffb8b8;
  --accent-contrast: #141414;
  --star-fill: #ffffff;

  --border-dotted: 1px dotted rgba(255, 255, 255, 0.15);
  --border-accent: rgba(250, 160, 160, 0.4);
  --glow-color: rgba(250, 160, 160, 0.15);
  --glow-card: 0 0 50px rgba(0, 0, 0, 0.45);

  --fg-primary: #ffffff;
  --fg-secondary: rgba(255, 255, 255, 0.78);
  --fg-tertiary: rgba(255, 255, 255, 0.45);

  --status-good: #4ade80;
  --status-bad: #ef4444;
  --status-bad-bg: rgba(239, 68, 68, 0.1);

  --font-main: 'Jacobs', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-brand: 'Unbounded', 'Jacobs', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 24px;
  --radius-pill: 9999px;
  --transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

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

body {
  background-color: var(--bg-page);
  color: var(--fg-primary);
  font-family: var(--font-main);
  min-height: 100vh;
  overflow-x: hidden;
  position: relative;
  -webkit-font-smoothing: antialiased;
}

/* Ambient Backdrops - Landing Parity */
.header-top-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 90px;
  background: linear-gradient(180deg, rgba(20, 20, 20, 0.95) 0%, rgba(20, 20, 20, 0) 100%);
  pointer-events: none;
  z-index: 99;
}

.bg-grid-linear {
  position: fixed;
  inset: 0;
  background-image: 
    linear-gradient(to right, rgba(255, 255, 255, 0.015) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(255, 255, 255, 0.015) 1px, transparent 1px);
  background-size: 56px 56px;
  pointer-events: none;
  z-index: 0;
}

.ambient-flare {
  position: fixed;
  border-radius: 50%;
  filter: blur(140px);
  pointer-events: none;
  z-index: 0;
  opacity: 0.22;
}
.ambient-flare-1 {
  top: -100px;
  left: 25%;
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, var(--accent) 0%, rgba(20, 20, 20, 0) 70%);
}

/* Header - Exact 1:1 Landing Parity (Seamless floating, no solid bar) */
.site-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 32px max(32px, calc(50vw - 580px + 32px));
  background: transparent;
  border-bottom: none;
  z-index: 150;
  pointer-events: none;
}
.site-header a, 
.site-header button, 
.site-header .header-status-pill {
  pointer-events: auto;
}

.header-logo-desktop {
  position: static !important;
  display: flex !important;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  user-select: none;
  transform: none;
}
.header-logo-desktop:hover {
  transform: scale(1.04);
}

.brand-logo-svg {
  width: 32px;
  height: 32px;
  flex-shrink: 0;
}
.logo-accent-path {
  fill: var(--accent);
}
.logo-star-path {
  fill: var(--star-fill);
}

.brand-name {
  font-family: var(--font-brand);
  font-weight: 700;
  font-size: 19px;
  letter-spacing: -0.03em;
  color: var(--fg-primary);
}
.brand-dot {
  color: var(--accent);
}

/* Subbrand text WITHOUT tablet pill - exact parity */
.header-subbrand-text {
  font-family: var(--font-brand);
  font-weight: 500;
  font-size: 13.5px;
  color: var(--fg-secondary);
  letter-spacing: -0.02em;
  line-height: 1;
  user-select: none;
  opacity: 0.75;
}

.header-actions-group {
  display: flex;
  align-items: center;
  gap: 12px;
}

.header-status-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background-color: var(--bg-badge);
  border: var(--border-dotted);
  padding: 6px 14px;
  border-radius: var(--radius-pill);
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--fg-secondary);
}

.status-dot-active {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background-color: var(--status-good);
  box-shadow: 0 0 8px var(--status-good);
  animation: pulse-dot 2.5s infinite ease-in-out;
}
@keyframes pulse-dot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.45; transform: scale(0.85); }
}

/* Pill Buttons */
.btn-pill-primary {
  background-color: var(--accent);
  color: var(--accent-contrast);
  font-family: var(--font-main);
  font-weight: 600;
  font-size: 13.5px;
  border: 1px solid var(--accent);
  border-radius: var(--radius-pill);
  padding: 10px 24px;
  cursor: pointer;
  transition: var(--transition);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-decoration: none;
}
.btn-pill-primary:hover {
  background-color: var(--accent-hover);
  border-color: var(--accent-hover);
  box-shadow: 0 4px 20px var(--glow-color);
  transform: translateY(-1px);
}

.btn-pill-secondary {
  background-color: var(--bg-badge);
  border: var(--border-dotted);
  color: var(--fg-secondary);
  font-family: var(--font-main);
  font-size: 12.5px;
  border-radius: var(--radius-pill);
  padding: 7px 16px;
  cursor: pointer;
  transition: var(--transition);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  text-decoration: none;
}
.btn-pill-secondary:hover {
  color: var(--fg-primary);
  border-color: rgba(255, 255, 255, 0.3);
  background-color: rgba(255, 255, 255, 0.08);
}

.btn-header-logout:hover {
  border-color: var(--status-bad);
  color: var(--status-bad);
}

/* Page Layout */
.page-container {
  max-width: 860px;
  margin: 0 auto;
  padding: 135px 24px 70px;
  position: relative;
  z-index: 2;
}

/* Hero Section */
.hero-content {
  text-align: center;
  margin-bottom: 32px;
}

.downloader-title {
  font-family: var(--font-main);
  font-size: clamp(30px, 5vw, 54px);
  font-weight: 400;
  line-height: 1.15;
  letter-spacing: -0.03em;
  color: var(--fg-primary);
  margin-bottom: 14px;
}

.font-accent-italic {
  font-family: var(--font-accent, 'Raleway', sans-serif);
  font-style: italic;
  font-weight: 600;
  letter-spacing: -0.05em;
  color: var(--accent);
  display: inline-block;
  padding: 0 4px;
}

.downloader-subtitle {
  font-family: var(--font-mono);
  font-size: clamp(13px, 1.5vw, 14.5px);
  color: var(--fg-secondary);
  max-width: 680px;
  margin: 0 auto 20px;
  line-height: 1.6;
}

/* Main Downloader Card */
.main-card {
  background-color: var(--bg-card);
  border: var(--border-dotted);
  border-radius: var(--radius-lg);
  box-shadow: var(--glow-card);
  padding: 30px;
  margin-bottom: 32px;
  transition: border-color 0.3s ease;
}
.main-card:focus-within {
  border-color: var(--border-accent);
}

/* Dropzone */
.dropzone-box {
  border: 1px dashed rgba(255, 255, 255, 0.2);
  border-radius: 18px;
  background-color: var(--bg-surface);
  padding: 42px 24px;
  text-align: center;
  cursor: pointer;
  transition: var(--transition);
  position: relative;
}
.dropzone-box:hover {
  border-color: var(--accent);
  background-color: var(--bg-card-hover);
  box-shadow: 0 0 30px var(--glow-color);
}
.dropzone-box.drag-over {
  border-color: var(--accent);
  background-color: rgba(250, 160, 160, 0.06);
  transform: scale(1.008);
}

.dropzone-icon-circle {
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background-color: var(--bg-badge);
  border: var(--border-dotted);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px;
  color: var(--accent);
  transition: var(--transition);
}
.dropzone-box:hover .dropzone-icon-circle {
  transform: scale(1.08);
  border-color: var(--accent);
}

.dropzone-main-text {
  font-family: var(--font-main);
  font-size: 18px;
  font-weight: 500;
  color: var(--fg-primary);
  margin-bottom: 8px;
}
.dropzone-main-text .accent-link {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 4px;
}

.dropzone-sub-text {
  font-family: var(--font-mono);
  font-size: 12.5px;
  color: var(--fg-tertiary);
  margin-bottom: 18px;
}

.dropzone-paste-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background-color: var(--bg-badge);
  border: var(--border-dotted);
  padding: 5px 14px;
  border-radius: var(--radius-pill);
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--fg-secondary);
}
.dropzone-paste-badge kbd {
  background-color: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 4px;
  padding: 1px 6px;
  font-size: 11px;
  color: #ffffff;
}

/* Progress bar */
.upload-progress-box {
  margin-top: 20px;
  background-color: var(--bg-surface);
  border: var(--border-dotted);
  border-radius: var(--radius-md);
  padding: 16px 20px;
}
.progress-track {
  width: 100%;
  height: 5px;
  background-color: rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-pill);
  overflow: hidden;
  margin-bottom: 8px;
}
.progress-fill {
  height: 100%;
  width: 0%;
  background-color: var(--accent);
  border-radius: var(--radius-pill);
  transition: width 0.2s ease;
}
.progress-text {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--fg-secondary);
  text-align: center;
}

/* Transparency Checkerboard Pattern */
.checkerboard-bg {
  background-color: #171717 !important;
  background-image: 
    linear-gradient(45deg, #222222 25%, transparent 25%),
    linear-gradient(-45deg, #222222 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #222222 75%),
    linear-gradient(-45deg, transparent 75%, #222222 75%) !important;
  background-size: 14px 14px !important;
  background-position: 0 0, 0 7px, 7px -7px, -7px 0 !important;
}

/* Recent Uploads */
.recent-section {
  margin-bottom: 32px;
}
.section-top-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.section-headline {
  font-family: var(--font-brand);
  font-size: 16px;
  font-weight: 600;
  color: var(--fg-primary);
  letter-spacing: -0.01em;
}
.btn-clean-text {
  background: transparent;
  border: none;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--fg-tertiary);
  cursor: pointer;
}
.btn-clean-text:hover {
  color: var(--fg-secondary);
}

.recent-cards-stack {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.recent-card-item {
  background-color: var(--bg-card);
  border: var(--border-dotted);
  border-radius: 16px;
  padding: 16px;
  display: flex;
  align-items: center;
  gap: 16px;
  transition: var(--transition);
}
.recent-card-item:hover {
  border-color: rgba(255, 255, 255, 0.25);
  background-color: var(--bg-card-hover);
}

.thumb-preview-box {
  width: 68px;
  height: 68px;
  border-radius: 10px;
  overflow: hidden;
  border: var(--border-dotted);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.thumb-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.recent-details {
  flex: 1;
  min-width: 0;
}
.recent-filename {
  font-family: var(--font-main);
  font-size: 14px;
  font-weight: 500;
  color: var(--fg-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 4px;
}
.recent-specs {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--fg-tertiary);
  margin-bottom: 8px;
}

.url-copy-box {
  display: flex;
  align-items: center;
  gap: 8px;
}
.url-input-field {
  flex: 1;
  background-color: var(--bg-surface);
  border: var(--border-dotted);
  border-radius: var(--radius-pill);
  padding: 6px 14px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--accent);
  outline: none;
}
.url-input-field:focus {
  border-color: var(--accent);
}

.btn-copy-action {
  background-color: var(--accent);
  color: var(--accent-contrast);
  font-family: var(--font-main);
  font-size: 12px;
  font-weight: 600;
  border: none;
  border-radius: var(--radius-pill);
  padding: 6px 16px;
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
}
.btn-copy-action:hover {
  background-color: var(--accent-hover);
}
.btn-copy-action.copied {
  background-color: var(--status-good);
}

.quick-actions-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
}
.btn-action-tag {
  background: transparent;
  border: var(--border-dotted);
  color: var(--fg-tertiary);
  font-family: var(--font-mono);
  font-size: 11px;
  border-radius: var(--radius-pill);
  padding: 2px 10px;
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
}
.btn-action-tag:hover {
  color: var(--fg-primary);
  border-color: rgba(255, 255, 255, 0.3);
}

/* Gallery Section */
.gallery-section {
  margin-top: 10px;
}
.gallery-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 12px;
}

.search-field-container {
  display: flex;
  align-items: center;
  background-color: var(--bg-surface);
  border: var(--border-dotted);
  border-radius: var(--radius-pill);
  padding: 4px 14px;
  gap: 8px;
}
.search-field-container input {
  background: transparent;
  border: none;
  outline: none;
  color: var(--fg-primary);
  font-family: var(--font-mono);
  font-size: 12.5px;
  width: 180px;
}

.gallery-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 18px;
}

.gallery-grid-card {
  background-color: var(--bg-card);
  border: var(--border-dotted);
  border-radius: 16px;
  overflow: hidden;
  transition: var(--transition);
  display: flex;
  flex-direction: column;
}
.gallery-grid-card:hover {
  border-color: rgba(255, 255, 255, 0.25);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

.grid-media-window {
  width: 100%;
  aspect-ratio: 16 / 10;
  position: relative;
  overflow: hidden;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.grid-media-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  transition: transform 0.25s ease;
}
.gallery-grid-card:hover .grid-media-img {
  transform: scale(1.03);
}

.grid-hover-overlay {
  position: absolute;
  inset: 0;
  background-color: rgba(20, 20, 20, 0.75);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  opacity: 0;
  transition: opacity 0.2s ease;
}
.gallery-grid-card:hover .grid-hover-overlay {
  opacity: 1;
}

.grid-card-footer {
  padding: 12px 14px;
}
.grid-card-title {
  font-family: var(--font-main);
  font-size: 13.5px;
  font-weight: 500;
  color: var(--fg-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 4px;
}
.grid-card-sub {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--fg-tertiary);
  display: flex;
  justify-content: space-between;
}

.empty-gallery-state {
  grid-column: 1 / -1;
  text-align: center;
  padding: 60px 20px;
  color: var(--fg-tertiary);
  font-family: var(--font-mono);
  font-size: 13px;
}

/* Pagination */
.pagination-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin-top: 32px;
}

/* Auth Modal - Exact 1:1 Downloader Parity */
.auth-popup-overlay,
.auth-modal-backdrop {
  position: fixed;
  inset: 0;
  background-color: rgba(10, 10, 10, 0.88);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.auth-popup-card {
  max-width: 420px;
  width: 100%;
  background-color: var(--bg-card);
  border: var(--border-dotted);
  border-radius: 24px;
  box-shadow: 0 0 60px rgba(0, 0, 0, 0.7);
  padding: 40px 32px;
  text-align: center;
}

.auth-logo-svg {
  width: 44px;
  height: 34px;
  margin: 0 auto 10px;
  display: block;
}

.auth-service-title {
  font-family: var(--font-brand, 'Unbounded', sans-serif);
  font-size: 19px;
  font-weight: 600;
  color: var(--fg-primary);
  letter-spacing: -0.02em;
  margin-top: 4px;
  margin-bottom: 24px;
  text-align: center;
}

.auth-brand-name {
  font-family: var(--font-brand);
  font-size: 20px;
  font-weight: 700;
  color: var(--fg-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-bottom: 24px;
}
.auth-subbrand-text {
  font-family: var(--font-brand);
  font-size: 15px;
  font-weight: 500;
  color: var(--fg-secondary);
  letter-spacing: -0.02em;
  opacity: 0.75;
}

.auth-form-wrap {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.auth-input-container {
  position: relative;
  display: flex;
  align-items: center;
}

.auth-password-field {
  width: 100%;
  background-color: var(--bg-surface);
  border: var(--border-dotted);
  border-radius: var(--radius-pill);
  color: var(--fg-primary);
  font-family: var(--font-mono);
  font-size: 14px;
  padding: 13px 48px 13px 20px;
  outline: none;
  transition: all 0.2s ease;
}
.auth-password-field:focus {
  border-color: var(--accent);
  box-shadow: 0 0 20px var(--glow-color);
}

.btn-password-visibility {
  position: absolute;
  right: 16px;
  background: transparent;
  border: none;
  color: var(--fg-tertiary);
  cursor: pointer;
  padding: 4px;
}
.btn-password-visibility:hover {
  color: var(--fg-primary);
}

.auth-error-notice {
  font-family: var(--font-mono);
  font-size: 12.5px;
  color: var(--status-bad);
  background-color: var(--status-bad-bg);
  border: 1px solid var(--status-bad);
  border-radius: var(--radius-pill);
  padding: 8px 16px;
}

.btn-auth-enter {
  width: 100%;
  padding: 13px;
  font-size: 14px;
  font-weight: 600;
  font-family: var(--font-main);
  background-color: var(--accent);
  color: var(--accent-contrast);
  border: 1px solid var(--accent);
  border-radius: var(--radius-pill);
  cursor: pointer;
  box-shadow: 0 4px 18px rgba(250, 160, 160, 0.25);
  transition: all 0.2s ease;
}
.btn-auth-enter:hover {
  background-color: var(--accent-hover);
  border-color: var(--accent-hover);
  box-shadow: 0 6px 24px rgba(250, 160, 160, 0.35);
  transform: translateY(-1px);
}

/* Lightbox Modal */
.lightbox-overlay {
  position: fixed;
  inset: 0;
  background-color: rgba(10, 10, 10, 0.92);
  backdrop-filter: blur(20px);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.lightbox-dismiss {
  position: absolute;
  top: 24px;
  right: 28px;
  background: none;
  border: none;
  color: var(--fg-primary);
  font-size: 32px;
  cursor: pointer;
  line-height: 1;
}

.lightbox-frame {
  max-width: 90vw;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}

.lightbox-img-wrapper {
  max-width: 88vw;
  max-height: 75vh;
  border-radius: 12px;
  overflow: hidden;
  border: var(--border-dotted);
  display: flex;
  align-items: center;
  justify-content: center;
}
.lightbox-img-wrapper img {
  max-width: 100%;
  max-height: 75vh;
  object-fit: contain;
}

.lightbox-caption-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  gap: 12px;
}
.lightbox-title {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--fg-secondary);
}

/* Toast System */
.toast-rack {
  position: fixed;
  bottom: 24px;
  right: 24px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 9999;
  pointer-events: none;
}
.toast-bubble {
  background-color: var(--bg-card);
  border: var(--border-dotted);
  border-radius: var(--radius-pill);
  padding: 9px 20px;
  color: var(--fg-primary);
  font-family: var(--font-mono);
  font-size: 12.5px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.6);
  pointer-events: auto;
  animation: slide-up 0.2s ease-out;
}
.toast-bubble.success {
  border-color: var(--status-good);
}
.toast-bubble.error {
  border-color: var(--status-bad);
}

@keyframes slide-up {
  from { transform: translateY(16px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

.hidden-element {
  display: none !important;
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
  .site-header {
    padding: 0 16px;
  }
  .page-container {
    padding: 96px 16px 50px;
  }
  .main-card {
    padding: 20px 16px;
  }
  .recent-card-item {
    flex-direction: column;
    align-items: flex-start;
  }
  .thumb-preview-box {
    width: 100%;
    height: 140px;
  }
  .gallery-cards-grid {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 12px;
  }
}
