/* Blueprint — global stylesheet.
   All static, non-data-driven visual styling lives here as classes. The only
   things that stay inline in index.html are per-item CSS custom properties
   for genuinely data-driven values (e.g. a tip's category color), set via
   style="--tag-bg:...; --tag-fg:...". See README for details. */

:root {
  --brand: #5C7080;
  --brand-tint: #e8edf1;
  --on-brand: #ffffff;
  --revit-blue: #0696D7;
  --border: #d3d7db;
  --border-subtle: #c7cdd3;
  --border-light: #e3e5e8;
  --text: #24292b;
  --text-muted: #454c51;
  --text-soft: #5b6268;
  --text-faint: #8a9096;
  --bg-page: #f4f5f6;
  --bg-card: #ffffff;
  --bg-input: #f9fafb;
  --overlay: rgba(20, 24, 28, 0.5);
  --shadow-card: 0 1px 2px rgba(20, 24, 28, 0.04);
  --shadow-card-hover: 0 4px 10px rgba(20, 24, 28, 0.08);
  --shadow-menu: 0 8px 24px rgba(20, 24, 28, 0.12);
  --shadow-modal: 0 20px 60px rgba(20, 24, 28, 0.3);
  --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* Reset */
html, body { margin: 0; padding: 0; }
* { box-sizing: border-box; }

/* Several classes below (.grid, .login-panel, .modal-overlay, ...) declare
   their own `display`, which otherwise silently overrides the native
   [hidden] attribute — this keeps hidden actually hidden no matter which
   class sets display, current or future. */
[hidden] { display: none !important; }

::-webkit-scrollbar { width: 10px; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 6px; }
::-webkit-scrollbar-track { background: transparent; }

/* Page shell */
.page {
  height: 100vh; width: 100%; display: flex; flex-direction: column; overflow: hidden;
  background: var(--bg-page); font-family: var(--font); color: var(--text);
}

/* Header */
.header {
  flex: 0 0 auto; display: flex; flex-direction: column; gap: 10px;
  padding: 12px 24px; background: var(--bg-card); border-bottom: 1px solid var(--border-light);
}
.header__top-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.header__search-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }

.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand__mark { width: 26px; height: 26px; border-radius: 6px; background: var(--brand); flex: 0 0 auto; }
.brand__name { font-size: 17px; font-weight: 700; letter-spacing: -0.01em; white-space: nowrap; }
.brand__by {
  font-size: 11px; color: var(--text-faint); padding-left: 8px;
  border-left: 1px solid var(--border-light); margin-left: 2px; white-space: nowrap;
}

.user-area { position: relative; flex: 0 0 auto; }

/* Shared outline button (secondary header actions: user button, filters button) */
.btn-outline {
  border: 1px solid var(--border); background: var(--bg-card); border-radius: 6px;
  padding: 8px 14px; font-weight: 600; cursor: pointer; white-space: nowrap;
}
.btn-user { color: var(--text); font-size: 14px; }

.user-menu {
  position: absolute; top: calc(100% + 6px); right: 0; background: var(--bg-card);
  border: 1px solid var(--border-light); border-radius: 8px; box-shadow: var(--shadow-menu);
  min-width: 170px; overflow: hidden; z-index: 50;
}
.user-menu__item {
  display: block; width: 100%; text-align: left; border: none; background: var(--bg-card);
  color: var(--text); font-size: 13.5px; font-weight: 600; padding: 11px 14px; cursor: pointer;
}
.user-menu__item:hover { background: var(--bg-page); }
.user-menu__item--divider { border-top: 1px solid var(--border-light); }

.search-input {
  flex: 1 1 220px; min-width: 140px; border: 1px solid var(--border); border-radius: 6px;
  padding: 8px 12px; font-size: 14px; outline: none; background: var(--bg-input);
}

.filter-btn { flex: 0 0 auto; color: var(--text-muted); font-size: 13px; }
.filter-btn--active { border-color: var(--brand); background: var(--brand-tint); color: var(--brand); }

/* Card grid area */
.grid-area { flex: 1 1 auto; position: relative; min-height: 0; }
.fade-top {
  position: absolute; top: 0; left: 0; right: 0; height: 14px;
  background: linear-gradient(var(--bg-page), transparent); pointer-events: none; z-index: 1;
}
.fade-bottom {
  position: absolute; bottom: 0; left: 0; right: 0; height: 14px;
  background: linear-gradient(transparent, var(--bg-page)); pointer-events: none; z-index: 1;
}
.grid-scroll { height: 100%; overflow-y: auto; overflow-x: hidden; padding: 20px 24px 24px; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }

.card {
  position: relative; background: var(--bg-card); border: 1px solid var(--border-light); border-radius: 10px;
  padding: 18px; display: flex; flex-direction: column; gap: 10px; box-shadow: var(--shadow-card); cursor: pointer;
}
.card:hover { box-shadow: var(--shadow-card-hover); border-color: var(--border-subtle); }
.card__tags { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

/* Category tag: bg/fg are per-category, set inline as --tag-bg/--tag-fg custom properties */
.tag { font-size: 11px; font-weight: 600; padding: 3px 8px; border-radius: 5px; background: var(--tag-bg); color: var(--tag-fg); }
.tag--premium { font-weight: 700; letter-spacing: 0.02em; background: var(--brand-tint); color: var(--brand); }

.card__title { margin: 0; font-size: 16px; font-weight: 700; line-height: 1.3; }
.card__summary { margin: 0; font-size: 13.5px; line-height: 1.5; color: var(--text-muted); }
.card__title.locked, .card__summary.locked { filter: blur(3px); }

.card__lock {
  position: absolute; inset: 0; border-radius: 10px; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 10px; background: rgba(255, 255, 255, 0.55);
  backdrop-filter: blur(1px);
}
.lock-icon {
  width: 26px; height: 20px; border: 2px solid var(--brand); border-top: none;
  border-radius: 0 0 4px 4px; position: relative;
}
.lock-icon__shackle {
  position: absolute; top: -14px; left: 5px; width: 12px; height: 14px;
  border: 2px solid var(--brand); border-bottom: none; border-radius: 8px 8px 0 0;
}

/* Shared primary (brand) button: unlock CTA, sign-in CTA, filter-modal Done */
.btn-primary {
  border: none; border-radius: 6px; padding: 8px 16px; font-size: 13px; font-weight: 700;
  cursor: pointer; background: var(--brand); color: var(--on-brand);
}
.btn-primary:hover { opacity: 0.9; }

.empty-state { padding: 60px 0; text-align: center; color: var(--text-faint); font-size: 14px; }

/* Login panel (shown instead of the grid when signed out) */
.login-panel {
  max-width: 380px; margin: 80px auto 0; text-align: center; display: flex; flex-direction: column;
  align-items: center; gap: 14px; padding: 36px 28px; background: var(--bg-card);
  border: 1px solid var(--border-light); border-radius: 12px; box-shadow: var(--shadow-card);
}
.login-panel__mark { width: 40px; height: 40px; border-radius: 9px; background: var(--brand); }
.login-panel__title { margin: 0; font-size: 18px; font-weight: 700; }
.login-panel__desc { margin: 0; font-size: 13.5px; line-height: 1.5; color: var(--text-muted); }
.btn-signin { padding: 10px 22px; font-size: 14px; margin-top: 6px; }

/* Demo plan toggle */
.demo-toggle {
  position: fixed; bottom: 14px; right: 14px; font-size: 11px; padding: 6px 10px; border-radius: 6px;
  border: 1px solid var(--border); background: var(--bg-card); color: var(--text-faint); cursor: pointer; z-index: 10;
}

/* Shared modal overlay (filter modal + detail modal) */
.modal-overlay {
  position: fixed; inset: 0; background: var(--overlay); display: flex;
  align-items: center; justify-content: center; z-index: 200; padding: 24px;
}

/* Shared modal box shell (filter modal + detail modal); each modal below
   only overrides its own max-width/max-height. */
.modal-box {
  background: var(--bg-card); border-radius: 12px; width: 100%;
  display: flex; flex-direction: column; overflow: hidden; box-shadow: var(--shadow-modal);
}
/* Shared modal close (✕) button */
.modal-close { border: none; background: transparent; font-size: 18px; line-height: 1; cursor: pointer; color: var(--text-faint); padding: 4px; }
.modal-close:hover { color: var(--text); }

/* Filter modal */
.filter-modal { max-width: 420px; max-height: 80vh; }
.filter-modal__header {
  flex: 0 0 auto; display: flex; align-items: center; justify-content: space-between;
  gap: 12px; padding: 18px 20px; border-bottom: 1px solid var(--border-light);
}
.filter-modal__title { margin: 0; font-size: 16px; font-weight: 700; }
.filter-modal__body { flex: 1 1 auto; overflow-y: auto; padding: 12px; display: flex; flex-direction: column; gap: 2px; }
.filter-modal__footer {
  flex: 0 0 auto; padding: 14px 20px; border-top: 1px solid var(--border-light);
  display: flex; justify-content: space-between; align-items: center;
}
.filter-modal__clear { border: none; background: transparent; color: var(--text-soft); font-size: 13px; font-weight: 600; cursor: pointer; padding: 4px; }

.filter-option {
  display: flex; align-items: center; gap: 10px; text-align: left; border: none; border-radius: 8px;
  padding: 10px 14px; font-size: 14px; font-weight: 600; cursor: pointer; background: transparent;
  color: var(--text); width: 100%;
}
.filter-option--active { background: var(--brand-tint); color: var(--brand); }
.filter-option__checkbox {
  width: 16px; height: 16px; border-radius: 4px; border: 1.5px solid var(--border-subtle); background: var(--bg-card);
  flex: 0 0 auto; display: flex; align-items: center; justify-content: center; font-size: 11px; color: var(--on-brand);
}
.filter-option--active .filter-option__checkbox { border-color: var(--brand); background: var(--brand); }

/* Detail modal */
.detail-modal { max-width: 640px; max-height: 85vh; }
.detail-modal__header {
  flex: 0 0 auto; display: flex; align-items: flex-start; justify-content: space-between;
  gap: 12px; padding: 20px 24px; border-bottom: 1px solid var(--border-light);
}
.detail-modal__heading { display: flex; flex-direction: column; gap: 8px; }
.detail-modal__tags { display: flex; gap: 8px; flex-wrap: wrap; }
.detail-modal__title { margin: 0; font-size: 20px; font-weight: 700; }
.detail-modal__body { flex: 1 1 auto; overflow-y: auto; padding: 20px 24px; display: flex; flex-direction: column; gap: 18px; }
.detail-modal__desc { margin: 0; font-size: 14.5px; line-height: 1.6; color: var(--text-muted); }
.detail-modal__steps { display: flex; flex-direction: column; gap: 16px; }

.step { display: flex; gap: 14px; align-items: flex-start; }
.step__num {
  flex: 0 0 auto; width: 24px; height: 24px; border-radius: 50%; background: var(--revit-blue);
  color: var(--on-brand); font-size: 12px; font-weight: 700; display: flex; align-items: center; justify-content: center;
}
.step__content { flex: 1 1 auto; display: flex; flex-direction: column; gap: 8px; }
.step__text { margin: 0; font-size: 14px; line-height: 1.5; }
.step__screenshot {
  height: 140px; border-radius: 8px;
  background: repeating-linear-gradient(45deg, #f1f3f4, #f1f3f4 10px, #e6e9eb 10px, #e6e9eb 20px);
  display: flex; align-items: center; justify-content: center; font-family: monospace;
  font-size: 12px; color: var(--text-faint); border: 1px solid var(--border-light);
}
