/* === HUDSON STREET DELI — CLIM Presentation-Based UI === */
/* Monochrome. Berkeley Mono. Single size. No chrome. */

@font-face {
  font-family: 'Berkeley Mono';
  src: url('fonts/BerkeleyMono-Regular.woff2') format('woff2');
  font-weight: 400;
}
@font-face {
  font-family: 'Berkeley Mono';
  src: url('fonts/BerkeleyMono-Bold.woff2') format('woff2');
  font-weight: 700;
}
@font-face {
  font-family: 'Berkeley Mono';
  src: url('fonts/BerkeleyMono-Oblique.woff2') format('woff2');
  font-weight: 400;
  font-style: italic;
}

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

:root {
  --bg: #000000;
  --fg: #CCCCCC;
  --fg-dim: #666666;
  --fg-bright: #FFFFFF;
  --accent: #CCCCCC;
  --highlight-bg: #333333;
  --selection-bg: #444444;
  --removed-fg: #555555;
  --sub-fg: #FFFFFF;
  --border: #333333;
  --mono: 'Berkeley Mono', monospace;
  --size: 13px;
  --line: 1.5;
  --pad: 2px;
}

html { font-size: var(--size); -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--mono);
  font-size: var(--size);
  line-height: var(--line);
  background: var(--bg);
  color: var(--fg);
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  padding: 0;
  cursor: default;
}

/* === HEADER === */
#header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 4px 8px;
  border-bottom: 1px solid var(--border);
  min-height: 1.5rem;
}
.brand { font-weight: 700; letter-spacing: 0.15em; color: var(--fg-bright); }
.mode { color: var(--fg-dim); font-style: italic; }

/* === MAIN === */
#main { flex: 1; overflow-y: auto; padding: 0 8px 8px; }

.view { display: none; }
.view.active { display: block; }

/* === COMMAND BARS === */
.cmd-bar {
  padding: 4px 0 2px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 4px;
  display: flex;
  gap: 0;
  white-space: pre-wrap;
  word-break: break-word;
}
.prompt { color: var(--fg-dim); font-weight: 700; }
.cmd-text { color: var(--fg); }

/* === PRESENTATIONS === */
.presentations { padding: 0; }

/* Generic presentation (clickable text object) */
.pres {
  cursor: pointer;
  border-bottom: 1px solid transparent;
  transition: border-color 0.05s;
  display: inline;
}
.pres:hover {
  border-bottom: 1px solid var(--fg);
}
.pres.selected {
  background: var(--selection-bg);
  outline: 1px solid var(--fg-dim);
  outline-offset: 1px;
}

/* Select mode: compatible presentations turn red, non-compatible dim out */
.pres.selectable {
  color: #ff4444;
  cursor: crosshair;
  border-bottom-color: transparent;
}
.pres.selectable:hover {
  background: transparent;
  border-bottom: 1px solid var(--fg);
}
.pres.select-disabled {
  color: #333333;
  cursor: default;
  pointer-events: none;
}

/* Presentation type annotations */
.pres-type {
  color: var(--fg-dim);
  font-style: italic;
  font-size: inherit;
}
.pres-id {
  color: var(--fg-dim);
}

/* Block-level presentations */
.pres-block {
  display: block;
  padding: 2px 0;
  cursor: pointer;
  border-bottom: 1px solid transparent;
}
.pres-block:hover {
  background: var(--highlight-bg);
}
.pres-block.selected {
  background: var(--selection-bg);
}

/* Section dividers */
.section-label {
  display: block;
  padding: 6px 0 2px;
  color: var(--fg-dim);
  font-style: italic;
  border-top: 1px solid var(--border);
  margin-top: 4px;
}

/* Ingredient states */
.ing-removed {
  color: var(--removed-fg);
  text-decoration: line-through;
}
.ing-substituted {
  color: var(--sub-fg);
  font-weight: 700;
}
.ing-required-missing {
  color: var(--fg-bright);
  font-style: italic;
}

/* Role tag (minimal) */
.role {
  color: var(--fg-dim);
  font-style: italic;
}

/* Substitution candidate */
.sub-candidate {
  display: block;
  padding: 2px 0 2px 16px;
  cursor: pointer;
  border-left: 2px solid var(--border);
  margin-left: 8px;
}
.sub-candidate:hover {
  border-left-color: var(--fg);
  background: var(--highlight-bg);
}
.sub-candidate.auto {
  border-left-color: var(--fg-bright);
}
.sub-candidate .sub-arrow {
  color: var(--fg-dim);
  margin-right: 4px;
}
.sub-candidate .sub-price {
  color: var(--fg-dim);
}
.sub-candidate .sub-reasoning {
  display: block;
  padding-left: 16px;
  color: var(--fg-dim);
  font-style: italic;
}
.sub-candidate .sub-allergen {
  color: var(--fg-bright);
  font-style: italic;
}

/* Action link */
.action {
  cursor: pointer;
  text-decoration: underline;
  text-decoration-style: dotted;
  text-underline-offset: 2px;
}
.action:hover {
  color: var(--fg-bright);
  text-decoration-style: solid;
}
.action.disabled {
  color: var(--removed-fg);
  cursor: default;
  text-decoration: none;
}
.action.disabled:hover {
  color: var(--removed-fg);
  text-decoration: none;
}

/* Divider line */
.divider {
  display: block;
  border-top: 1px solid var(--border);
  height: 0;
  margin: 4px 0;
}

/* Indented block */
.indent { padding-left: 16px; }
.indent2 { padding-left: 32px; }

/* Key hint */
.key-hint {
  color: var(--fg-dim);
  border: 1px solid var(--border);
  padding: 0 3px;
  font-size: inherit;
}

/* Cart item */
.cart-item-block {
  display: block;
  padding: 2px 0;
  border-top: 1px solid var(--border);
  margin-top: 4px;
}

/* Tracker step */
.tracker-step {
  display: block;
  padding: 2px 0;
}
.tracker-step.done::before { content: "✓ "; color: var(--fg-bright); }
.tracker-step.pending::before { content: "○ "; color: var(--fg-dim); }
.tracker-step.active::before { content: "● "; color: var(--fg-bright); }

/* === COMMAND LINE FOOTER === */
#command-line {
  border-top: 1px solid var(--border);
  padding: 4px 8px;
  background: var(--bg);
  flex-shrink: 0;
}
.action-result {
  color: var(--fg-bright);
  border-bottom: 1px solid var(--border);
  padding: 0 0 4px;
  margin: 0 0 4px;
  min-height: 1.5em;
  white-space: pre-wrap;
}
.cmd-input-area {
  display: flex;
  white-space: pre;
}
.cmd-buffer { color: var(--fg-bright); }
.cmd-cursor {
  animation: blink 1s step-end infinite;
  color: var(--fg-bright);
}
@keyframes blink {
  50% { opacity: 0; }
}
.cmd-hint {
  color: var(--fg-dim);
  font-style: italic;
  padding-top: 2px;
}

/* === CONTEXT MENU === */
#context-menu {
  position: absolute;
  background: #111111;
  border: 1px solid var(--fg);
  padding: 4px 0;
  min-width: 280px;
  max-width: 500px;
  z-index: 1000;
  font-family: var(--mono);
  font-size: var(--size);
  line-height: var(--line);
}
.ctx-header {
  padding: 2px 8px;
  color: var(--fg-bright);
  font-weight: 700;
  border-bottom: 1px solid var(--border);
  margin-bottom: 2px;
}
.ctx-item {
  padding: 2px 8px;
  cursor: pointer;
  display: block;
}
.ctx-item:hover {
  background: var(--highlight-bg);
}
.ctx-item.disabled {
  color: var(--removed-fg);
  cursor: default;
}
.ctx-item.disabled:hover {
  background: transparent;
}
.ctx-item .ctx-desc {
  display: block;
  padding-left: 16px;
  color: var(--fg-dim);
  font-style: italic;
  font-size: inherit;
}

/* === SCROLLBAR === */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border); }

/* Desktop centering */
@media (min-width: 700px) {
  body { max-width: 640px; margin: 0 auto; }
}
