/* Darkroom — minimalist RAW developer. Dark theme, brand ember #ff5e00. */

:root {
  --bg: #0a0a0b;
  --panel: #121214;
  --panel-2: #17171a;
  --line: #26262b;
  --text: #f2f2f7;
  --dim: #9a9aa3;
  --brand: #ff5e00;
  --brand-soft: #ff842b;
  --font-head: "Rajdhani", system-ui, sans-serif;
  --font-body: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.45 var(--font-body);
  overflow: hidden;
}

.app {
  display: flex;
  flex-direction: column;
  height: 100%;
}

/* ---- top bar ---- */
.bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 14px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  flex: 0 0 auto;
}
.bar__brand {
  font-family: var(--font-head);
  font-size: 19px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text);
  margin-right: 6px;
}
.bar__info {
  flex: 1;
  min-width: 0;
  color: var(--dim);
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.bar__btn {
  background: var(--panel-2);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 6px 14px;
  font: 600 13px var(--font-body);
  cursor: pointer;
}
.bar__btn:hover:not(:disabled) { border-color: var(--brand); }
.bar__btn:disabled { opacity: 0.45; cursor: default; }
.bar__btn--accent {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
}
.bar__btn--accent:hover:not(:disabled) { background: var(--brand-soft); border-color: var(--brand-soft); }

/* ---- stage ---- */
.stage {
  display: flex;
  flex: 1 1 auto;
  min-height: 0;
}
.viewport {
  position: relative;
  flex: 1;
  min-width: 0;
  background:
    radial-gradient(120% 90% at 50% 40%, #131315 0%, var(--bg) 70%);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.viewport__canvas {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  display: none;
}
.viewport__canvas.is-live { display: block; }
.viewport__placeholder {
  max-width: 96%;
  max-height: 96%;
  object-fit: contain;
}
.viewport__hint {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--dim);
  font-family: var(--font-head);
  font-size: 22px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  pointer-events: none;
}
.viewport.is-drag {
  outline: 2px dashed var(--brand);
  outline-offset: -8px;
}

/* ---- right panel ---- */
.panel {
  width: 280px;
  flex: 0 0 280px;
  background: var(--panel);
  border-left: 1px solid var(--line);
  overflow-y: auto;
  padding: 10px 14px 24px;
}
.panel__sec {
  padding: 10px 0 12px;
  border-bottom: 1px solid var(--line);
}
.panel__sec:last-child { border-bottom: none; }
.panel__title {
  margin: 0 0 8px;
  font-family: var(--font-head);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--dim);
}
.panel__row {
  display: grid;
  grid-template-columns: 72px 1fr 44px;
  align-items: center;
  gap: 8px;
  margin: 6px 0;
  font-size: 12px;
  color: var(--dim);
}
.panel__row output {
  text-align: right;
  font-variant-numeric: tabular-nums;
  color: var(--text);
}
.panel__select {
  width: 100%;
  background: var(--panel-2);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 6px 8px;
  font: 13px var(--font-body);
}
.panel__lens {
  font-size: 12px;
  color: var(--text);
  margin-bottom: 6px;
  word-break: break-word;
}
.panel__lens small { color: var(--dim); display: block; }
.panel__toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--dim);
}
.panel__btnrow {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}
.panel__mini {
  background: var(--panel-2);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 5px 10px;
  font: 500 12px var(--font-body);
  cursor: pointer;
}
.panel__mini:hover { border-color: var(--brand); }
.panel__mini--accent {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
}
.panel__mini.is-on {
  border-color: var(--brand);
  color: var(--brand);
}
.panel__curve {
  width: 100%;
  height: 170px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 6px;
  touch-action: none;
  cursor: crosshair;
}

/* ---- range inputs ---- */
input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 20px;
  background: transparent;
  cursor: ew-resize;
}
input[type="range"]::-webkit-slider-runnable-track {
  height: 3px;
  background: var(--line);
  border-radius: 2px;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: var(--text);
  margin-top: -5px;
  border: none;
}
input[type="range"]::-moz-range-track {
  height: 3px;
  background: var(--line);
  border-radius: 2px;
}
input[type="range"]::-moz-range-thumb {
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: var(--text);
  border: none;
}

/* ---- filmstrip ---- */
.strip {
  flex: 0 0 auto;
  background: var(--panel);
  border-top: 1px solid var(--line);
  padding: 8px 10px;
  min-height: 30px;
}
.strip__list {
  display: flex;
  gap: 8px;
  overflow-x: auto;
}
.strip__item {
  flex: 0 0 auto;
  width: 86px;
  height: 58px;
  border: 2px solid transparent;
  border-radius: 4px;
  background: var(--panel-2);
  padding: 0;
  cursor: pointer;
  overflow: hidden;
}
.strip__item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.strip__item.is-active { border-color: var(--brand); }

/* ---- crop overlay ---- */
.crop {
  position: absolute;
  border: 1.5px solid #fff;
  box-shadow: 0 0 0 9999px rgba(0, 0, 0, 0.55);
  cursor: move;
  touch-action: none;
}
.crop__grid {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(to right, transparent calc(33.33% - 0.5px), rgba(255,255,255,0.35) 33.33%, transparent calc(33.33% + 0.5px)),
    linear-gradient(to right, transparent calc(66.66% - 0.5px), rgba(255,255,255,0.35) 66.66%, transparent calc(66.66% + 0.5px)),
    linear-gradient(to bottom, transparent calc(33.33% - 0.5px), rgba(255,255,255,0.35) 33.33%, transparent calc(33.33% + 0.5px)),
    linear-gradient(to bottom, transparent calc(66.66% - 0.5px), rgba(255,255,255,0.35) 66.66%, transparent calc(66.66% + 0.5px));
}
.crop__handle {
  position: absolute;
  width: 14px;
  height: 14px;
  background: #fff;
  border-radius: 2px;
}
.crop__handle--n  { top: -7px;  left: calc(50% - 7px);  cursor: ns-resize; }
.crop__handle--s  { bottom: -7px; left: calc(50% - 7px); cursor: ns-resize; }
.crop__handle--w  { left: -7px;  top: calc(50% - 7px);  cursor: ew-resize; }
.crop__handle--e  { right: -7px; top: calc(50% - 7px);  cursor: ew-resize; }
.crop__handle--nw { left: -7px;  top: -7px;  cursor: nwse-resize; }
.crop__handle--ne { right: -7px; top: -7px;  cursor: nesw-resize; }
.crop__handle--sw { left: -7px;  bottom: -7px; cursor: nesw-resize; }
.crop__handle--se { right: -7px; bottom: -7px; cursor: nwse-resize; }

.cropbar {
  display: flex;
  align-items: center;
  gap: 22px;
  padding: 8px 14px;
  background: var(--panel);
  border-top: 1px solid var(--line);
  flex: 0 0 auto;
  flex-wrap: wrap;
}
.cropbar__aspects { display: flex; gap: 6px; }
.cropbar__aspect {
  background: var(--panel-2);
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: 6px;
  padding: 4px 10px;
  font: 500 12px var(--font-body);
  cursor: pointer;
}
.cropbar__aspect.is-active {
  border-color: var(--brand);
  color: var(--brand);
}
.cropbar__straighten {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--dim);
  flex: 1;
  min-width: 220px;
}
.cropbar__straighten input { flex: 1; }
.cropbar__straighten output {
  width: 48px;
  text-align: right;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}
.cropbar__actions { display: flex; gap: 8px; }

/* ---- dialog & toast ---- */
.dlg {
  background: var(--panel);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 18px;
  min-width: 300px;
}
.dlg::backdrop { background: rgba(0, 0, 0, 0.6); }
.dlg__title {
  margin: 0 0 12px;
  font-family: var(--font-head);
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.dlg__actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 16px;
}

.toast {
  position: fixed;
  bottom: 76px;
  left: 50%;
  transform: translateX(-50%);
  background: #26262b;
  color: var(--text);
  border: 1px solid var(--line);
  border-left: 3px solid var(--brand);
  border-radius: 8px;
  padding: 10px 16px;
  font-size: 13px;
  max-width: 70vw;
  z-index: 50;
}
