/* =============================================
   TIERRA INTERACTIVES LIBRARY — style.css
   Dark editorial / monospace aesthetic
   ============================================= */

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

:root {
  --bg:        #0c0c0e;
  --bg2:       #131316;
  --bg3:       #1a1a1f;
  --border:    #2a2a32;
  --border2:   #3a3a46;
  --text:      #e8e8f0;
  --muted:     #6b6b80;
  --accent:    #a0f0b0;
  --accent2:   #6060ff;
  --font-head: 'Syne', sans-serif;
  --font-mono: 'DM Mono', monospace;
  --radius:    12px;
  --card-w:    280px;
}

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 13px;
  min-height: 100vh;
  overflow-x: hidden;
}

/* ── HEADER ── */

.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  padding: 0 32px;
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 56px;
}

.logo-block {
  display: flex;
  align-items: baseline;
  gap: 8px;
  font-family: var(--font-head);
  letter-spacing: 0.04em;
}

.logo-word {
  font-size: 18px;
  font-weight: 800;
  color: var(--text);
}

.logo-divider {
  color: var(--muted);
  font-weight: 300;
  font-size: 18px;
}

.logo-sub {
  font-size: 11px;
  font-weight: 500;
  color: var(--accent);
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.header-right {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--muted);
  letter-spacing: 0.06em;
}

.filter-bar {
  display: flex;
  gap: 4px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}

.filter-btn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 5px 14px;
  border-radius: 100px;
  cursor: pointer;
  transition: all 0.15s;
}

.filter-btn:hover {
  border-color: var(--border2);
  color: var(--text);
}

.filter-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #0c0c0e;
  font-weight: 500;
}

.search-row {
  padding: 10px 0 12px;
}

.search-input {
  width: 100%;
  max-width: 360px;
  background: var(--bg3);
  border: 1px solid var(--border);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 12px;
  padding: 8px 14px;
  border-radius: 8px;
  outline: none;
  transition: border-color 0.15s;
}

.search-input::placeholder { color: var(--muted); }
.search-input:focus { border-color: var(--border2); }

/* ── GRID ── */

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(var(--card-w), 1fr));
  gap: 20px;
  padding: 28px 32px 60px;
}

/* ── CARD ── */

.card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  transition: border-color 0.2s, transform 0.2s;
  display: flex;
  flex-direction: column;
  animation: fadeUp 0.3s ease both;
}

.card:hover {
  border-color: var(--border2);
  transform: translateY(-2px);
}

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

.card-preview {
  position: relative;
  width: 100%;
  aspect-ratio: 9 / 16;
  background: #000;
  overflow: hidden;
}

.card-preview iframe {
  width: 390px;
  height: 844px;
  border: none;
  pointer-events: none;
  transform-origin: top left;
  position: absolute;
  top: 0;
  left: 0;
}

.card-cta-hint {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 15%;
  border-top: 1.5px dashed rgba(255,255,255,0.25);
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  z-index: 10;
}

.card-cta-hint-label {
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.08em;
  color: rgba(255,255,255,0.5);
  text-transform: uppercase;
  background: rgba(0,0,0,0.55);
  padding: 2px 8px;
  border-radius: 4px;
}

.card-body {
  padding: 14px 16px 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
}

.card-meta-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.card-category {
  font-size: 9px;
  font-family: var(--font-mono);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
  font-weight: 500;
}

.card-date {
  font-size: 9px;
  color: var(--muted);
}

.card-name {
  font-family: var(--font-head);
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.3;
}

.card-client {
  font-size: 11px;
  color: var(--muted);
}

.card-cta-row {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-top: 4px;
}

.cta-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
  border: 1.5px solid rgba(255,255,255,0.15);
}

.cta-label {
  font-size: 10px;
  color: var(--muted);
  font-family: var(--font-mono);
}

/* ── MODAL ── */

.modal-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.85);
  z-index: 200;
  backdrop-filter: blur(6px);
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.modal-backdrop.open {
  display: flex;
  animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.modal {
  background: var(--bg2);
  border: 1px solid var(--border2);
  border-radius: 16px;
  width: 100%;
  max-width: 860px;
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
  animation: scaleIn 0.2s ease;
}

@keyframes scaleIn {
  from { opacity: 0; transform: scale(0.97); }
  to   { opacity: 1; transform: scale(1); }
}

.modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  background: var(--bg3);
  border: 1px solid var(--border);
  color: var(--muted);
  font-size: 14px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
  z-index: 10;
}

.modal-close:hover { color: var(--text); border-color: var(--border2); }

.modal-layout {
  display: grid;
  grid-template-columns: 260px 1fr;
  min-height: 500px;
}

/* phone shell */
.modal-preview {
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 28px 20px;
  border-right: 1px solid var(--border);
  border-radius: 16px 0 0 16px;
}

.phone-shell {
  width: 200px;
  height: 430px;
  background: #0a0a0a;
  border-radius: 36px;
  border: 2px solid #333;
  position: relative;
  overflow: hidden;
  box-shadow: 0 0 0 6px #111, 0 24px 60px rgba(0,0,0,0.8);
}

.phone-notch {
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 80px;
  height: 24px;
  background: #0a0a0a;
  border-radius: 0 0 16px 16px;
  z-index: 20;
}

.phone-screen {
  position: absolute;
  inset: 0;
  overflow: hidden;
  border-radius: 34px;
}

.phone-screen iframe {
  width: 390px;
  height: 844px;
  border: none;
  transform-origin: top left;
  position: absolute;
  top: 0;
  left: 0;
  pointer-events: none;
}

.cta-badge {
  position: absolute;
  bottom: 10px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0,0,0,0.7);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 100px;
  padding: 4px 10px;
  display: flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
  z-index: 30;
}

.cta-badge-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

#ctaBadgeText {
  font-family: var(--font-mono);
  font-size: 8px;
  letter-spacing: 0.06em;
  color: rgba(255,255,255,0.7);
  text-transform: uppercase;
}

/* modal info panel */
.modal-info {
  padding: 32px 28px;
  display: flex;
  flex-direction: column;
  gap: 0;
}

.modal-tag {
  font-size: 9px;
  font-family: var(--font-mono);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 10px;
}

.modal-title {
  font-family: var(--font-head);
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.2;
  margin-bottom: 8px;
}

.modal-client {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 4px;
}

.modal-date {
  font-size: 11px;
  color: var(--muted);
  margin-bottom: 24px;
}

.modal-section {
  margin-bottom: 20px;
}

.modal-label {
  font-size: 9px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 8px;
  font-family: var(--font-mono);
}

.cta-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.cta-swatch {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 1.5px solid rgba(255,255,255,0.15);
  flex-shrink: 0;
}

.cta-info {
  font-size: 12px;
  color: var(--text);
  font-family: var(--font-mono);
}

.notes-box {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent2);
  border-radius: 8px;
  padding: 12px 14px;
  font-size: 11px;
  line-height: 1.7;
  color: var(--muted);
}

.notes-box strong { color: var(--text); }

.modal-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: auto;
  padding-top: 20px;
}

.btn-primary {
  display: block;
  text-align: center;
  background: var(--accent);
  color: #0c0c0e;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.04em;
  padding: 12px 20px;
  border-radius: 8px;
  text-decoration: none;
  transition: opacity 0.15s;
}

.btn-primary:hover { opacity: 0.85; }

.btn-secondary {
  display: block;
  width: 100%;
  text-align: center;
  background: transparent;
  border: 1px solid var(--border2);
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 12px;
  padding: 11px 20px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.15s;
}

.btn-secondary:hover { color: var(--text); border-color: var(--border2); background: var(--bg3); }

.copy-confirm {
  display: none;
  font-size: 11px;
  color: var(--accent);
  text-align: center;
  letter-spacing: 0.06em;
  font-family: var(--font-mono);
}

.copy-confirm.show { display: block; }

/* ── EMPTY STATE ── */

.empty-state {
  grid-column: 1 / -1;
  text-align: center;
  color: var(--muted);
  padding: 80px 20px;
  font-size: 13px;
  line-height: 2;
}

/* ── SCROLLBAR ── */

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

/* ── RESPONSIVE ── */

@media (max-width: 640px) {
  .site-header { padding: 0 16px; }
  .grid { padding: 16px; gap: 14px; }
  --card-w: 100%;
  .modal-layout { grid-template-columns: 1fr; }
  .modal-preview { border-right: none; border-bottom: 1px solid var(--border); border-radius: 16px 16px 0 0; }
}
