/* CloudHavenX — style.css */

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

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

:root {
  --bg:          #ffffff;
  --surface:     #f5f5f3;
  --surface2:    #ebebea;
  --border:      rgba(0,0,0,0.09);
  --border2:     rgba(0,0,0,0.18);
  --text:        #111110;
  --muted:       #6b6b6b;
  --hint:        #a1a09e;
  --accent:      #1a56db;
  --accent-ring: rgba(26,86,219,0.12);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg:          #111110;
    --surface:     #1a1a18;
    --surface2:    #222220;
    --border:      rgba(255,255,255,0.08);
    --border2:     rgba(255,255,255,0.15);
    --text:        #e8e8e6;
    --muted:       #8a8a88;
    --hint:        #5a5a58;
    --accent:      #4f7cff;
    --accent-ring: rgba(79,124,255,0.15);
  }
}

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
}

body {
  font-family: 'Geist', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

/* ─── Top bar ─────────────────────────────────────────────── */

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 24px;
  border-bottom: 0.5px solid var(--border);
}

.brand {
  font-family: 'Instrument Serif', Georgia, serif;
  font-size: 18px;
  letter-spacing: -0.2px;
  color: var(--text);
  text-decoration: none;
}

.brand em {
  font-style: italic;
  opacity: 0.4;
}

.topbar-nav {
  display: flex;
  align-items: center;
  gap: 20px;
}

.topbar-nav a {
  font-size: 13px;
  color: var(--muted);
  text-decoration: none;
  transition: color 0.15s;
}

.topbar-nav a:hover {
  color: var(--text);
  text-decoration: none;
}

.nav-divider {
  width: 0.5px;
  height: 14px;
  background: var(--border2);
  flex-shrink: 0;
}

/* ─── Home / hero ─────────────────────────────────────────── */

.home {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px 24px 32px;
  text-align: center;
}

.home-brand {
  font-family: 'Instrument Serif', Georgia, serif;
  font-size: 48px;
  letter-spacing: -1.5px;
  line-height: 1;
  margin-bottom: 8px;
  color: var(--text);
}

.home-brand em {
  font-style: italic;
  color: var(--muted);
}

.home-tagline {
  font-size: 14px;
  color: var(--muted);
  font-weight: 300;
  margin-bottom: 36px;
  letter-spacing: 0.1px;
}

/* ─── Search field ────────────────────────────────────────── */

.search-outer {
  width: 100%;
  max-width: 580px;
  position: relative;
  margin-bottom: 12px;
}

.search-field {
  width: 100%;
  height: 50px;
  border: 0.5px solid var(--border2);
  border-radius: 12px;
  background: var(--bg);
  color: var(--text);
  font-family: 'Geist', sans-serif;
  font-size: 15px;
  padding: 0 54px 0 18px;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.search-field:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-ring);
}

.search-field::placeholder {
  color: var(--hint);
}

.search-btn {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background: var(--text);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.15s;
  flex-shrink: 0;
}

.search-btn:hover {
  opacity: 0.72;
}

.search-btn svg {
  width: 15px;
  height: 15px;
  stroke: var(--bg);
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* ─── Filter pills ────────────────────────────────────────── */

.pills {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: center;
  margin-bottom: 36px;
}

.pill {
  font-size: 12px;
  padding: 5px 14px;
  border-radius: 20px;
  border: 0.5px solid var(--border);
  color: var(--muted);
  cursor: pointer;
  background: var(--surface);
  transition: border-color 0.15s, color 0.15s;
  font-family: 'Geist', sans-serif;
  line-height: 1;
}

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

.pill.active {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--bg);
}

/* ─── Trust row ───────────────────────────────────────────── */

.trust-row {
  display: flex;
  gap: 20px;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
}

.trust-item {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  color: var(--hint);
}

.trust-item svg {
  width: 13px;
  height: 13px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex-shrink: 0;
}

.trust-sep {
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: var(--border2);
  flex-shrink: 0;
}

/* ─── Results page ────────────────────────────────────────── */

.results-page {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.results-topbar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 24px;
  border-bottom: 0.5px solid var(--border);
}

.results-field {
  flex: 1;
  max-width: 560px;
  height: 38px;
  border: 0.5px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  font-family: 'Geist', sans-serif;
  font-size: 14px;
  padding: 0 14px;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.results-field:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-ring);
}

.results-field::placeholder {
  color: var(--hint);
}

.results-go {
  height: 38px;
  padding: 0 18px;
  border: 0.5px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
  font-family: 'Geist', sans-serif;
  font-size: 13px;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s;
}

.results-go:hover {
  background: var(--surface);
}

/* ─── Result tabs ─────────────────────────────────────────── */

.tabs-row {
  display: flex;
  border-bottom: 0.5px solid var(--border);
  padding: 0 24px;
  overflow-x: auto;
  scrollbar-width: none;
}

.tabs-row::-webkit-scrollbar { display: none; }

.rtab {
  font-size: 13px;
  padding: 10px 14px;
  color: var(--muted);
  cursor: pointer;
  border: none;
  border-bottom: 1.5px solid transparent;
  margin-bottom: -0.5px;
  background: none;
  font-family: 'Geist', sans-serif;
  white-space: nowrap;
  transition: color 0.15s;
  text-decoration: none;
  display: inline-block;
}

.rtab:hover {
  color: var(--text);
  text-decoration: none;
}

.rtab.active {
  color: var(--text);
  border-bottom-color: var(--text);
}

/* ─── Results meta ────────────────────────────────────────── */

.results-meta {
  padding: 8px 24px;
  font-size: 12px;
  color: var(--hint);
  border-bottom: 0.5px solid var(--border);
}

/* ─── Results layout ──────────────────────────────────────── */

.results-body {
  display: flex;
  flex: 1;
  align-items: flex-start;
}

.results-main {
  flex: 1;
  padding: 0 24px;
  min-width: 0;
}

.results-aside {
  width: 240px;
  flex-shrink: 0;
  border-left: 0.5px solid var(--border);
  padding: 20px 20px;
}

/* ─── Individual result card ──────────────────────────────── */

.result {
  padding: 20px 0;
  border-bottom: 0.5px solid var(--border);
}

.result:last-child {
  border-bottom: none;
}

.result-crumb {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 4px;
}

.result-fav {
  width: 15px;
  height: 15px;
  border-radius: 3px;
  background: var(--surface);
  border: 0.5px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 9px;
  color: var(--muted);
  flex-shrink: 0;
  font-weight: 500;
}

.result-url {
  font-size: 12px;
  color: var(--muted);
}

.result-title {
  font-size: 16px;
  font-weight: 500;
  color: var(--accent);
  margin-bottom: 5px;
  line-height: 1.35;
  cursor: pointer;
  transition: opacity 0.15s;
  display: block;
  text-decoration: none;
}

.result-title:hover {
  opacity: 0.72;
  text-decoration: none;
}

.result-desc {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.65;
  font-weight: 300;
}

.result-desc b {
  color: var(--text);
  font-weight: 500;
}

/* ─── Images tab grid ─────────────────────────────────────── */

.results-body.images-mode {
  display: block;
}

.image-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 350px;
  gap: 16px;
  align-items: start;
}

.image-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
  padding: 16px 0 20px;
}

.image-card {
  background: var(--surface);
  border: 0.5px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.image-card.active {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-ring);
}

.image-thumb-link {
  display: block;
  background: var(--surface2);
  cursor: zoom-in;
}

.image-thumb {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  display: block;
}

.image-meta {
  padding: 10px 10px 12px;
}

.image-title {
  color: var(--text);
  font-size: 13px;
  font-weight: 500;
  line-height: 1.35;
  text-decoration: none;
  display: -webkit-box;
  line-clamp: 2;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.image-title:hover {
  text-decoration: underline;
}

.image-host {
  display: block;
  margin-top: 4px;
  font-size: 11px;
  color: var(--hint);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.image-desc {
  margin-top: 6px;
  font-size: 11px;
  color: var(--muted);
  line-height: 1.45;
  display: -webkit-box;
  line-clamp: 2;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.image-viewer {
  position: sticky;
  top: 14px;
  border: 0.5px solid var(--border);
  border-radius: 12px;
  background: var(--bg);
  overflow: hidden;
}

.image-viewer-close {
  width: 100%;
  border: none;
  border-bottom: 0.5px solid var(--border);
  background: var(--surface);
  color: var(--muted);
  font-size: 12px;
  padding: 9px 12px;
  text-align: right;
  cursor: pointer;
}

.image-viewer-media {
  display: block;
  background: var(--surface2);
}

.image-viewer-media img {
  width: 100%;
  max-height: 360px;
  object-fit: contain;
  display: block;
  background: var(--surface2);
}

.image-viewer-meta {
  padding: 12px;
}

.image-viewer-title {
  font-size: 14px;
  font-weight: 500;
  margin-bottom: 5px;
}

.image-viewer-host {
  font-size: 12px;
  color: var(--hint);
  margin-bottom: 8px;
}

.image-viewer-desc {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.45;
  margin-bottom: 10px;
}

.image-viewer-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.image-action {
  border: 0.5px solid var(--border2);
  border-radius: 8px;
  padding: 7px 12px;
  font-size: 12px;
  color: var(--text);
  text-decoration: none;
  background: var(--surface);
}

.image-action.primary {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.image-action:hover {
  text-decoration: none;
  opacity: 0.9;
}

/* ─── Aside / sidebar ─────────────────────────────────────── */

.aside-label {
  font-size: 11px;
  color: var(--hint);
  letter-spacing: 0.5px;
  text-transform: uppercase;
  margin-bottom: 10px;
}

.aside-item {
  padding: 7px 0;
  border-bottom: 0.5px solid var(--border);
  font-size: 13px;
  color: var(--muted);
  cursor: pointer;
  transition: color 0.15s;
  display: flex;
  align-items: center;
  gap: 7px;
  text-decoration: none;
}

.aside-item:last-child {
  border-bottom: none;
}

.aside-item:hover {
  color: var(--text);
  text-decoration: none;
}

.aside-item svg {
  width: 13px;
  height: 13px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex-shrink: 0;
}

/* ─── Safe/privacy bar ────────────────────────────────────── */

.safe-bar {
  padding: 9px 24px;
  border-top: 0.5px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
}

.safe-left {
  display: flex;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
}

.safe-item {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  color: var(--hint);
}

.safe-item svg {
  width: 12px;
  height: 12px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex-shrink: 0;
}

.safe-right {
  font-size: 11px;
  color: var(--hint);
}

/* ─── No results / error ──────────────────────────────────── */

.empty-state {
  text-align: center;
  padding: 64px 24px;
}

.empty-state svg {
  width: 36px;
  height: 36px;
  stroke: var(--border2);
  fill: none;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
  display: block;
  margin: 0 auto 16px;
}

.empty-title {
  font-size: 15px;
  font-weight: 500;
  margin-bottom: 6px;
}

.empty-sub {
  font-size: 13px;
  color: var(--muted);
  font-weight: 300;
}

/* ─── Footer ──────────────────────────────────────────────── */

.footer {
  padding: 20px 24px;
  border-top: 0.5px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}

.footer-links {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
}

.footer-links a {
  font-size: 12px;
  color: var(--hint);
  text-decoration: none;
  transition: color 0.15s;
}

.footer-links a:hover {
  color: var(--muted);
  text-decoration: none;
}

.footer-copy {
  font-size: 12px;
  color: var(--hint);
}

/* ─── Responsive ──────────────────────────────────────────── */

@media (max-width: 640px) {
  .results-aside { display: none; }
  .home-brand    { font-size: 36px; }
  .topbar        { padding: 12px 16px; }
  .home          { padding: 40px 16px 24px; }
  .results-main  { padding: 0 16px; }
  .results-topbar{ padding: 10px 16px; }
  .tabs-row      { padding: 0 16px; }
  .results-meta  { padding: 8px 16px; }
  .safe-bar      { padding: 9px 16px; }
  .footer        { padding: 16px; }
  .trust-row     { gap: 12px; }
  .image-grid    { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
}

@media (max-width: 900px) {
  .image-shell {
    grid-template-columns: 1fr;
  }

  .image-viewer {
    position: static;
  }
}