/*
  שפת העיצוב של החברה (פחם, לבן וזהב), כמו במערכת התזרים ובאתר החברה.
  Heebo לטקסט, Assistant לכותרות. הגופנים נשמרים מקומית כדי שיעבדו גם בלי אינטרנט.
*/
@font-face { font-family: Heebo; font-weight: 400; font-display: swap; src: url(fonts/heebo-hebrew-400-normal.woff2) format("woff2"); unicode-range: U+0590-05FF, U+200C-2010, U+20AA, U+25CC, U+FB1D-FB4F; }
@font-face { font-family: Heebo; font-weight: 400; font-display: swap; src: url(fonts/heebo-latin-400-normal.woff2) format("woff2"); unicode-range: U+0000-00FF, U+2000-206F, U+20AC, U+2122; }
@font-face { font-family: Heebo; font-weight: 500; font-display: swap; src: url(fonts/heebo-hebrew-500-normal.woff2) format("woff2"); unicode-range: U+0590-05FF, U+200C-2010, U+20AA, U+25CC, U+FB1D-FB4F; }
@font-face { font-family: Heebo; font-weight: 500; font-display: swap; src: url(fonts/heebo-latin-500-normal.woff2) format("woff2"); unicode-range: U+0000-00FF, U+2000-206F, U+20AC, U+2122; }
@font-face { font-family: Heebo; font-weight: 700; font-display: swap; src: url(fonts/heebo-hebrew-700-normal.woff2) format("woff2"); unicode-range: U+0590-05FF, U+200C-2010, U+20AA, U+25CC, U+FB1D-FB4F; }
@font-face { font-family: Heebo; font-weight: 700; font-display: swap; src: url(fonts/heebo-latin-700-normal.woff2) format("woff2"); unicode-range: U+0000-00FF, U+2000-206F, U+20AC, U+2122; }
@font-face { font-family: Assistant; font-weight: 700; font-display: swap; src: url(fonts/assistant-hebrew-700-normal.woff2) format("woff2"); unicode-range: U+0590-05FF, U+200C-2010, U+20AA, U+25CC, U+FB1D-FB4F; }
@font-face { font-family: Assistant; font-weight: 700; font-display: swap; src: url(fonts/assistant-latin-700-normal.woff2) format("woff2"); unicode-range: U+0000-00FF, U+2000-206F, U+20AC, U+2122; }
@font-face { font-family: Assistant; font-weight: 800; font-display: swap; src: url(fonts/assistant-hebrew-800-normal.woff2) format("woff2"); unicode-range: U+0590-05FF, U+200C-2010, U+20AA, U+25CC, U+FB1D-FB4F; }
@font-face { font-family: Assistant; font-weight: 800; font-display: swap; src: url(fonts/assistant-latin-800-normal.woff2) format("woff2"); unicode-range: U+0000-00FF, U+2000-206F, U+20AC, U+2122; }

:root {
  --background: #f4f4f2;
  --surface: #ffffff;
  --surface-sunken: #eeede9;
  --foreground: #242525;
  --muted: #5f5c57;
  --line: #e3e1dc;
  --control-border: #8c8882;
  --accent: #242525;
  --accent-strong: #3e3f3f;
  --on-accent: #ffffff;
  --brand: #7d5a22;
  --brand-mark: #a8792f;
  --brand-soft: #f8efe0;
  --done: #0b7a4b;
  --done-soft: #e2f4ea;
  --danger: #b3261e;
  --danger-soft: #fdecea;
  --font-sans: Heebo, "Segoe UI", Arial, sans-serif;
  --font-display: Assistant, Heebo, "Segoe UI", Arial, sans-serif;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  background: var(--background);
  color: var(--foreground);
  font-family: var(--font-sans);
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { font-family: var(--font-display); }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---- Header ---- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 56px;
  padding: calc(8px + env(safe-area-inset-top)) 16px 8px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}
.company-logo {
  display: block;
  flex-shrink: 0;
  width: 70px;
  height: 26px;
  background: var(--foreground);
  -webkit-mask: url(brand/solomon-logo.png) center / contain no-repeat;
  mask: url(brand/solomon-logo.png) center / contain no-repeat;
}
.topbar .divider { width: 1px; height: 24px; background: var(--line); flex-shrink: 0; }
.topbar h1 {
  flex: 1;
  margin: 0;
  font-size: 21px;
  line-height: 28px;
  font-weight: 800;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  border: 1px solid var(--control-border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--foreground);
  font-size: 18px;
  cursor: pointer;
}
.icon-btn:active { background: var(--surface-sunken); }

main {
  max-width: 720px;
  margin: 0 auto;
  padding: 20px 16px calc(32px + env(safe-area-inset-bottom));
}

/* ---- Cards & text ---- */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 14px;
}
.card h2 { margin: 0 0 12px; font-size: 20px; line-height: 26px; font-weight: 800; }
.muted { color: var(--muted); font-size: 14px; }
.row { display: flex; gap: 10px; align-items: center; }
.row > .grow { flex: 1; }
.stack > * + * { margin-top: 12px; }

/* ---- Buttons ---- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 46px;
  padding: 0 16px;
  border: 1px solid var(--control-border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--foreground);
  font: inherit;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: background-color .15s;
}
.btn:active { background: var(--surface-sunken); }
.btn.primary { background: var(--accent); border-color: transparent; color: var(--on-accent); }
.btn.primary:active { background: var(--accent-strong); }
.btn.danger { border-color: var(--danger); color: var(--danger); }
.btn.danger:active { background: var(--danger-soft); }
.btn.block { width: 100%; }
.btn.big { min-height: 56px; font-size: 17px; }
.btn.small { min-height: 34px; padding: 0 12px; font-size: 14px; font-weight: 500; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn svg { width: 20px; height: 20px; flex-shrink: 0; }

/* ---- Forms ---- */
label { display: block; font-size: 14px; font-weight: 500; margin-bottom: 6px; }
input[type=text], input[type=number], input[type=date] {
  width: 100%;
  min-height: 46px;
  padding: 8px 12px;
  border: 1px solid var(--control-border);
  border-radius: 8px;
  font: inherit;
  color: var(--foreground);
  background: var(--surface);
}
input:focus { outline: 2px solid var(--accent); outline-offset: -1px; }

/* ---- Home ---- */
.project-item { cursor: pointer; }
.project-item strong {
  display: block;
  font-family: var(--font-display);
  font-size: 19px;
  font-weight: 800;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.progress {
  height: 6px;
  border-radius: 3px;
  background: var(--surface-sunken);
  overflow: hidden;
  margin-top: 10px;
}
.progress > div { height: 100%; background: var(--brand-mark); }

/* ---- Project ---- */
.tiles {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(62px, 1fr));
  gap: 8px;
}
.tile {
  position: relative;
  aspect-ratio: 1;
  border: 1px solid var(--control-border);
  border-radius: 8px;
  background: var(--surface);
  font: inherit;
  font-size: 18px;
  font-weight: 700;
  color: var(--foreground);
  font-variant-numeric: tabular-nums;
  cursor: pointer;
}
.tile.mamam { background: var(--brand-soft); border-color: var(--brand-mark); }
.tile.done { background: var(--done-soft); border-color: var(--done); color: var(--done); }
.tile .count {
  position: absolute;
  bottom: 4px;
  left: 0;
  right: 0;
  font-size: 11px;
  font-weight: 500;
}
.section-list .btn { justify-content: space-between; width: 100%; margin-bottom: 8px; }
.section-list .btn:last-child { margin-bottom: 0; }
.section-list .btn.done { border-color: var(--done); color: var(--done); background: var(--done-soft); }

/* ---- Item ---- */
.photo-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  margin-top: 14px;
}
.photo-grid img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 8px;
  background: var(--surface-sunken);
  cursor: pointer;
}
.note-link {
  background: none;
  border: 0;
  padding: 6px 0;
  color: var(--brand);
  font: inherit;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
}
.note-input { font-size: 15px !important; min-height: 40px !important; }

.photo-grid img.new { outline: 3px solid var(--brand-mark); outline-offset: -3px; }
.empty-shot {
  grid-column: 1 / -1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 150px;
  border: 2px dashed var(--control-border);
  border-radius: 12px;
  background: var(--surface-sunken);
  color: var(--muted);
  font: inherit;
  font-size: 15px;
  cursor: pointer;
}
.empty-shot svg { width: 40px; height: 40px; }

/* ---- Bottom dock (item screen): everything the thumb needs while shooting ---- */
main:has(.dock) { padding-bottom: calc(140px + env(safe-area-inset-bottom)); }
.dock {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 20;
  background: var(--surface);
  border-top: 1px solid var(--line);
  box-shadow: 0 -4px 16px rgba(36, 37, 37, .06);
  padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
}
.dock-inner {
  max-width: 720px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 8px;
}
.dock-nav {
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 60px;
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  color: var(--foreground);
  font: inherit;
  text-align: start;
  cursor: pointer;
}
.dock-nav:active { background: var(--surface-sunken); }
.dock-nav.next { justify-content: flex-end; text-align: end; grid-column: 3; }
.dock-nav.next svg { transform: scaleX(-1); }
.dock-nav svg { width: 22px; height: 22px; flex-shrink: 0; }
.dock-nav span { display: flex; flex-direction: column; min-width: 0; }
.dock-nav small { color: var(--muted); font-size: 12px; line-height: 16px; }
.dock-nav b {
  font-size: 15px;
  line-height: 20px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.shutter-wrap { grid-column: 2; display: flex; flex-direction: column; align-items: center; gap: 4px; }
.shutter {
  width: 78px;
  height: 78px;
  border-radius: 50%;
  border: 4px solid var(--surface);
  box-shadow: 0 0 0 3px var(--brand-mark);
  background: var(--accent);
  color: var(--on-accent);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform .1s;
}
.shutter:active { transform: scale(.94); background: var(--accent-strong); }
.shutter svg { width: 34px; height: 34px; }
.shutter.busy { pointer-events: none; }
.shutter.busy svg { animation: pulse 1s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .3; } }
.shutter-label { font-size: 13px; font-weight: 700; }

/* ---- Wizard & settings ---- */
.building-row { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.building-row span { width: 70px; flex-shrink: 0; font-weight: 500; }
.building-row input { flex: 1; min-width: 0; }
.building-head { margin-bottom: 4px; }
.building-head small { flex: 1; color: var(--muted); font-size: 13px; font-weight: 500; }
.tiles-label { margin: 14px 0 8px; font-size: 14px; font-weight: 500; color: var(--muted); }
.logo-preview {
  max-width: 180px;
  max-height: 80px;
  display: block;
  margin: 10px 0;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
}

/* ---- Overlays ---- */
.overlay, .lightbox {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
}
.overlay { background: rgba(20, 21, 21, .5); padding: 16px; }
.overlay-box {
  width: 100%;
  max-width: 320px;
  background: var(--surface);
  padding: 24px;
  border-radius: 12px;
  text-align: center;
  font-weight: 500;
}
.overlay-box .title { font-family: var(--font-display); font-size: 22px; font-weight: 800; margin-bottom: 4px; }
.spinner {
  width: 36px;
  height: 36px;
  margin: 0 auto 12px;
  border: 4px solid var(--surface-sunken);
  border-top-color: var(--brand-mark);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.lightbox { flex-direction: column; background: #141515; }
.lightbox img { max-width: 100%; max-height: calc(100% - 90px); object-fit: contain; }
.lightbox-bar { display: flex; gap: 12px; padding: 16px; }

.toast {
  position: fixed;
  bottom: calc(20px + env(safe-area-inset-bottom));
  left: 50%;
  transform: translateX(-50%);
  z-index: 60;
  max-width: 90%;
  padding: 10px 16px;
  border-radius: 8px;
  background: var(--foreground);
  color: var(--on-accent);
  font-size: 14px;
}

body:has(.dock) .toast { bottom: calc(130px + env(safe-area-inset-bottom)); }

[hidden] { display: none !important; }
