/* ===== SEPPIA — Filter Tool Styles ===== */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600&family=Space+Mono&display=swap');

@font-face {
  font-family: 'Turnpike';
  src: url('Turnpike.ttf') format('truetype');
  font-weight: normal;
  font-style: normal;
}

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

:root {
  --bg-deep: #0d0b09;
  --bg-dark: #1a1412;
  --bg-card: #231e1a;
  --bg-card-hover: #2e2620;
  --sepia: #c8956c;
  --sepia-light: #e8a87c;
  --sepia-pale: #bea891;
  --amber: #d4a574;
  --cream: #f5efe6;
  --text: #e8e0d6;
  --text-dim: #9a8e82;
  --text-muted: #6b6058;
  --border: rgba(190, 168, 145, 0.15);
  --border-hover: rgba(190, 168, 145, 0.35);
  --font-logo: 'Turnpike', serif;
  --font-display: 'Inter', -apple-system, sans-serif;
  --font-body: 'Inter', -apple-system, sans-serif;
  --font-mono: 'Space Mono', monospace;
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
}

html { font-size: 16px; scroll-behavior: smooth; }
body {
  font-family: var(--font-body);
  background: var(--bg-deep);
  color: var(--text);
  line-height: 1.6;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  cursor: none;
  min-height: 100vh;
}

a { color: var(--sepia-light); text-decoration: none; }
button { font-family: var(--font-body); cursor: none; }

/* --- Custom Cursor --- */
.cursor {
  position: fixed; top: 0; left: 0; width: 8px; height: 8px;
  background: var(--sepia-pale); border-radius: 50%;
  pointer-events: none; z-index: 10001;
  transform: translate(-50%, -50%);
  transition: width 0.2s, height 0.2s, background-color 0.2s;
}
.cursor-follower {
  position: fixed; top: 0; left: 0; width: 40px; height: 40px;
  border: 1px solid rgba(190, 168, 145, 0.4); border-radius: 50%;
  pointer-events: none; z-index: 10000;
  transform: translate(-50%, -50%);
  transition: width 0.3s var(--ease-out), height 0.3s var(--ease-out),
              background-color 0.3s, border-color 0.3s;
}
.cursor.hovering { width: 0; height: 0; }
.cursor-follower.hovering {
  width: 60px; height: 60px;
  background: rgba(190, 168, 145, 0.08);
  border-color: var(--sepia-pale);
}

/* --- Film Grain (static, no animation to avoid flicker) --- */
.grain-overlay {
  position: fixed; inset: 0; z-index: 9999; pointer-events: none; opacity: 0.035;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-size: 200px;
}

/* --- Header --- */
header {
  border-bottom: 1px solid var(--border);
  padding: 0 2rem;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  background: rgba(13, 11, 9, 0.92);
  backdrop-filter: blur(12px);
  z-index: 100;
}
.logo {
  font-family: var(--font-logo);
  font-size: 1.6rem;
  color: var(--cream);
  letter-spacing: 0.04em;
}
.logo span { color: var(--sepia); }
.header-title {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-dim);
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.header-model {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--sepia);
  background: rgba(200, 149, 108, 0.1);
  border: 1px solid rgba(200, 149, 108, 0.25);
  padding: 0.3rem 0.8rem;
  border-radius: 2px;
  letter-spacing: 0.1em;
}

/* --- Main Layout --- */
main {
  display: grid;
  grid-template-columns: 1fr 360px;
  gap: 0;
  min-height: calc(100vh - 64px);
}

/* --- Left Panel (Preview) --- */
.panel-left {
  padding: 1.5rem;
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.preview-area {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 4px;
  overflow: hidden;
  position: relative;
  min-height: 420px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.preview-area canvas {
  max-width: 100%;
  max-height: 520px;
  display: block;
  margin: auto;
}
.preview-empty {
  text-align: center;
  padding: 3rem;
  color: var(--text-muted);
}
.preview-empty svg {
  width: 48px;
  height: 48px;
  margin: 0 auto 1rem;
  opacity: 0.3;
  display: block;
}
.preview-empty p {
  font-size: 0.85rem;
  font-family: var(--font-mono);
}
.preview-nav {
  position: absolute;
  bottom: 0.75rem;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: rgba(13, 11, 9, 0.7);
  backdrop-filter: blur(8px);
  border: 1px solid var(--border);
  border-radius: 2px;
  padding: 0.35rem 0.75rem;
}
.preview-nav button {
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 1rem;
  padding: 0;
  line-height: 1;
  transition: color 0.2s;
}
.preview-nav button:hover { color: var(--sepia-light); }
.preview-nav .nav-count {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--text-dim);
  min-width: 3.5rem;
  text-align: center;
}

/* --- Thumbnails --- */
.thumbnails-label {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 0.5rem;
}
.thumbnails-row {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  align-items: flex-start;
}
.thumb-item {
  width: 64px;
  height: 64px;
  border: 2px solid var(--border);
  border-radius: 3px;
  overflow: hidden;
  cursor: none;
  position: relative;
  flex-shrink: 0;
  transition: border-color 0.2s;
}
.thumb-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.thumb-item.active { border-color: var(--sepia); }
.thumb-item:hover { border-color: var(--sepia-pale); }
.thumb-remove {
  position: absolute;
  top: 2px; right: 2px;
  width: 16px; height: 16px;
  background: rgba(13,11,9,0.8);
  border: none;
  border-radius: 50%;
  color: var(--text-dim);
  font-size: 0.6rem;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.2s;
  line-height: 1;
  cursor: none;
}
.thumb-item:hover .thumb-remove { opacity: 1; }

/* --- Drop Zone --- */
.drop-zone {
  border: 1px dashed var(--border);
  border-radius: 4px;
  padding: 1.25rem;
  text-align: center;
  cursor: none;
  transition: border-color 0.3s, background 0.3s;
  position: relative;
}
.drop-zone:hover, .drop-zone.dragging {
  border-color: var(--sepia);
  background: rgba(200, 149, 108, 0.04);
}
.drop-zone input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: none;
  width: 100%;
  height: 100%;
}
.drop-zone-icon {
  font-size: 1.5rem;
  margin-bottom: 0.5rem;
  opacity: 0.4;
}
.drop-zone p {
  font-size: 0.8rem;
  color: var(--text-dim);
}
.drop-zone strong {
  color: var(--sepia-pale);
  font-weight: 500;
}
.drop-zone small {
  display: block;
  font-family: var(--font-mono);
  font-size: 0.65rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

/* --- Instructions --- */
.instructions {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1rem 1.25rem;
}
.instructions h4 {
  font-size: 0.7rem;
  font-family: var(--font-mono);
  color: var(--sepia-pale);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 0.6rem;
}
.instructions ol {
  padding-left: 1.25rem;
  color: var(--text-muted);
  font-size: 0.78rem;
  line-height: 1.8;
}

/* --- Right Panel (Controls) --- */
.panel-right {
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  overflow-y: auto;
  max-height: calc(100vh - 64px);
  position: sticky;
  top: 64px;
  height: calc(100vh - 64px);
}

.control-section {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1rem 1.25rem;
}
.control-section-title {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  margin-bottom: 1rem;
  padding-bottom: 0.6rem;
  border-bottom: 1px solid var(--border);
}

/* --- Sliders --- */
.slider-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}
.slider-row:last-child { margin-bottom: 0; }
.slider-label {
  font-size: 0.78rem;
  color: var(--text-dim);
  min-width: 90px;
  flex-shrink: 0;
}
.slider-wrap {
  flex: 1;
  position: relative;
}
input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 2px;
  background: var(--border);
  border-radius: 1px;
  outline: none;
  cursor: none;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--sepia);
  border: 2px solid var(--bg-card);
  cursor: none;
  transition: background 0.2s, transform 0.2s;
  box-shadow: 0 0 0 1px var(--sepia);
}
input[type="range"]:hover::-webkit-slider-thumb,
input[type="range"]:focus::-webkit-slider-thumb {
  background: var(--sepia-light);
  transform: scale(1.2);
}
input[type="range"]:disabled { opacity: 0.3; }
input[type="range"]:disabled::-webkit-slider-thumb { cursor: not-allowed; }

.slider-value {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--sepia-pale);
  min-width: 2.8rem;
  text-align: right;
}

/* --- Brand Panel Note --- */
.brand-panel-note {
  display: block;
  font-family: var(--font-mono);
  font-size: 0.6rem;
  color: var(--text-muted);
  letter-spacing: 0.04em;
  text-transform: none;
  margin-top: 0.2rem;
  font-weight: 400;
}

/* --- Brand Panel Cards (inside right panel) --- */
.brand-panel-grid {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.brand-panel-card {
  display: grid;
  grid-template-columns: 28px 1fr auto;
  align-items: center;
  gap: 0.6rem;
  background: var(--bg-card-hover);
  border: 1px solid var(--border);
  border-radius: 3px;
  overflow: hidden;
  transition: border-color 0.2s;
}
.brand-panel-card:hover { border-color: var(--sepia-pale); }
.bpc-swatch {
  width: 28px;
  align-self: stretch;
  min-height: 44px;
}
.bpc-info {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  padding: 0.45rem 0;
  min-width: 0;
}
.bpc-tag {
  font-family: var(--font-mono);
  font-size: 0.55rem;
  color: var(--sepia);
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.bpc-name {
  font-size: 0.78rem;
  color: var(--cream);
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.bpc-actions {
  display: flex;
  gap: 0.35rem;
  padding-right: 0.5rem;
  flex-shrink: 0;
}
.bpc-btn-apply,
.bpc-btn-dl {
  font-size: 0.68rem;
  padding: 0.3rem 0.55rem;
  border-radius: 3px;
  border: 1px solid var(--border);
  cursor: pointer;
  font-family: var(--font-body);
  font-weight: 500;
  transition: all 0.2s;
  white-space: nowrap;
  text-decoration: none;
  display: inline-block;
  line-height: 1.4;
}
.bpc-btn-apply {
  background: transparent;
  color: var(--text-dim);
}
.bpc-btn-apply:hover { border-color: var(--sepia-pale); color: var(--cream); }
.bpc-btn-dl {
  background: var(--sepia);
  color: var(--bg-deep);
  border-color: var(--sepia);
  font-weight: 600;
}
.bpc-btn-dl:hover { background: var(--sepia-light); border-color: var(--sepia-light); }

/* --- Action Buttons --- */
.actions-col {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.btn-action {
  width: 100%;
  padding: 0.65rem 1rem;
  border-radius: 3px;
  font-size: 0.8rem;
  font-weight: 500;
  border: 1px solid transparent;
  transition: all 0.25s var(--ease-out);
  position: relative;
  overflow: hidden;
  text-align: center;
}
.btn-action:disabled { opacity: 0.3; cursor: not-allowed; }

.btn-primary {
  background: var(--sepia);
  color: var(--bg-deep);
  border-color: var(--sepia);
}
.btn-primary:hover:not(:disabled) { background: var(--sepia-light); border-color: var(--sepia-light); }
.btn-primary::after {
  content: '';
  position: absolute;
  top: 0; left: -100%;
  width: 60%;
  height: 100%;
  background: linear-gradient(120deg, transparent, rgba(255,255,255,0.2), transparent);
  transition: left 0.5s;
}
.btn-primary:hover::after { left: 150%; }

.btn-ghost {
  background: transparent;
  color: var(--text-dim);
  border-color: var(--border);
}
.btn-ghost:hover:not(:disabled) {
  border-color: var(--sepia-pale);
  color: var(--cream);
}

.btn-reset {
  background: transparent;
  color: var(--text-muted);
  border-color: var(--border);
  font-family: var(--font-mono);
  font-size: 0.72rem;
}
.btn-reset:hover:not(:disabled) {
  color: var(--text-dim);
  border-color: var(--text-muted);
}

/* --- Processing indicator --- */
.processing-badge {
  display: none;
  font-family: var(--font-mono);
  font-size: 0.65rem;
  color: var(--sepia);
  text-align: center;
  padding: 0.25rem;
  animation: pulse 1s ease-in-out infinite;
}
.processing-badge.visible { display: block; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.4; } }

/* --- Scrollbar --- */
.panel-right::-webkit-scrollbar { width: 4px; }
.panel-right::-webkit-scrollbar-track { background: transparent; }
.panel-right::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

/* --- Touch devices: disable custom cursor --- */
@media (pointer: coarse) {
  body { cursor: auto; }
  a, button { cursor: pointer; }
  .cursor, .cursor-follower { display: none; }
}

/* --- Tablet (900px) --- */
@media (max-width: 900px) {
  main {
    grid-template-columns: 1fr;
  }
  .panel-right {
    position: static;
    height: auto;
    max-height: none;
    border-top: 1px solid var(--border);
    overflow-y: visible;
  }
  .preview-area {
    min-height: 280px;
  }
}

/* --- Mobile (600px) --- */
@media (max-width: 600px) {
  header {
    padding: 0 1rem;
    height: 56px;
  }
  .logo { font-size: 1.3rem; }
  .header-title { display: none; }
  .header-model { font-size: 0.6rem; padding: 0.25rem 0.55rem; }

  .panel-left, .panel-right { padding: 0.9rem; gap: 0.9rem; }

  .preview-area { min-height: 220px; }

  /* Larger thumb targets on mobile */
  .thumb-item { width: 56px; height: 56px; }

  .slider-row { gap: 0.5rem; }
  .slider-label { min-width: 72px; font-size: 0.72rem; }
  .slider-value { min-width: 2.4rem; font-size: 0.65rem; }

  input[type="range"]::-webkit-slider-thumb {
    width: 20px; height: 20px;
  }

  .bpc-name { font-size: 0.72rem; }

  .btn-action { padding: 0.7rem 1rem; font-size: 0.78rem; }

  .instructions { display: none; }
}

/* --- Small phones (360px) --- */
@media (max-width: 380px) {
  .slider-label { min-width: 58px; }
}

/* --- Mobile landscape --- */
@media (max-height: 500px) and (orientation: landscape) {
  header {
    height: 48px;
    padding: 0 1rem;
  }
  .logo { font-size: 1.1rem; }
  .header-title { font-size: 0.65rem; }
  .header-model { display: none; }

  main {
    grid-template-columns: 1fr 1fr;
    height: calc(100vh - 48px);
  }
  .panel-left {
    overflow-y: auto;
  }
  .panel-right {
    position: static;
    height: 100%;
    max-height: calc(100vh - 48px);
    overflow-y: auto;
    border-top: none;
    border-left: 1px solid var(--border);
  }
  .preview-area { min-height: 150px; }
  .instructions { display: none; }
  .control-section-title { font-size: 0.6rem; }
  .slider-row { gap: 0.4rem; }
  .slider-label { min-width: 60px; font-size: 0.68rem; }
  .slider-value { font-size: 0.6rem; min-width: 2rem; }
  .bpc-swatch { min-height: 36px; }
  .bpc-name { font-size: 0.7rem; }
}

