/* =========================================================
   Search / Home / Pins / Web overlays
   (from home_style.css)
   ========================================================= */

.brand{
  text-align:center;
  margin:4rem 0 2.5rem;
}

.logo{
  font-size:clamp(2.4rem,5vw,3.4rem);
  font-weight:700;
  letter-spacing:.04em;
  margin:0 0 .4rem;
}

.dot{ color:var(--accent); }

.tagline{
  margin:0;
  font-size:.9rem;
  color:var(--muted);
}

form{
  width:100%;
  max-width:620px;
  display:flex;
  gap:.6rem;
  margin-bottom:1rem;
}

input[type="search"]{
  flex:1;
  padding:.9rem 1.2rem;
  border-radius:999px;
  border:1px solid var(--border-subtle);
  background:var(--card-bg);
  color:var(--fg);
  font-size:1rem;
  outline:none;
}

input[type="search"]::placeholder{ color:var(--muted); }

input[type="search"]:focus{
  border-color:var(--accent);
  box-shadow:0 0 0 1px var(--accent);
}

.hint{
  font-size:.78rem;
  color:var(--muted);
  margin-bottom:1.5rem;
  text-align:center;
}

/* Full-bleed results area so .pins can behave like Pinterest */
.results-shell{
  width:100vw;
  max-width:none;

  /* break out of the centered main container */
  position:relative;
  left:50%;
  right:50%;
  margin-left:-50vw;
  margin-right:-50vw;

  margin-top:1.5rem;
  border-top:1px solid var(--border-subtle);

  /* keep comfortable page gutters */
  padding:1.2rem 1.5rem 0;
}

/* Keep the meta bar readable on huge screens */
.results-shell .meta{
  max-width:1200px;
  margin:0 auto .75rem;
  padding:0 .25rem;
}

/* Default (non-pins) results stay readable */
.results:not(.pins){
  max-width: 900px;
  margin: 0 auto;
}

.meta{
  display:none;
  justify-content:space-between;
  align-items:center;
  font-size:.8rem;
  color:var(--muted);
  margin-bottom:.75rem;
}

.results{ width:100%; }

.result{
  padding:.75rem 0;
  border-bottom:1px solid var(--result-border);
}

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

.result-title{
  font-size:1rem;
  font-weight:600;
  margin:0;
}

.result-title a{
  color:var(--accent-soft);
  text-decoration:none;
}

.result-title a:hover{ text-decoration:underline; }

.result-url{
  font-size:.8rem;
  color:var(--url);
  margin:.1rem 0 .3rem;
}

.result-snippet{
  font-size:.92rem;
  color:var(--muted-strong);
}

.result.has-thumb{
  display:flex;
  gap:12px;
  align-items:flex-start;
}

.result-thumb{
  width:72px;
  height:72px;
  object-fit:cover;
  border-radius:12px;
  flex:0 0 auto;
}

.result-main{ flex:1; min-width:0; }

.empty{
  font-size:.9rem;
  color:var(--muted);
  margin-top:.25rem;
}

footer{
  margin-top:3rem;
  font-size:.75rem;
  color:var(--muted);
  text-align:center;
}

/* Web overlay */
.web-overlay{
  position:fixed;
  inset:0;
  display:flex;
  align-items:center;
  justify-content:center;
  background:rgba(0,0,0,.45);
  padding:20px;
  z-index:9999;
}

.web-overlay-card{
  width:min(720px, 95vw);
  max-height:85vh;
  overflow:auto;
  background:var(--card-bg);
  border:1px solid rgba(0,0,0,.08);
  border-radius:16px;
  padding:14px;
}

.web-overlay-top{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  margin-bottom:10px;
}

.web-overlay-close{
  border:none;
  background:transparent;
  font-size:18px;
  cursor:pointer;
}

.web-link{
  padding:10px 0;
  border-top:1px solid rgba(0,0,0,.08);
}

.web-link-title{
  margin:0 0 4px 0;
  font-size:16px;
}

.web-link-domain{
  font-size:12px;
  opacity:.7;
  margin-bottom:6px;
}

.web-link-snippet{
  margin:0;
  opacity:.85;
}

/* =========================================================
   Pins masonry (consolidated, single definition)
   - In your original file there were 3 overlapping masonry blocks.
   - This is the "centred + wide-screen fills more" version, and it
     also enforces 2 columns on mobile.
   ========================================================= */

.pins{
  width: 100%;
  margin: 0 auto;
  column-gap: 14px;

  column-count: 6;
  column-width: auto;

  column-fill: balance;
  max-width: 1800px;
}

@media (max-width: 1800px){
  .pins{
    column-count: 5;
    max-width: 1500px;
  }
}

@media (max-width: 1500px){
  .pins{
    column-count: 4;
    max-width: 1200px;
  }
}

@media (max-width: 1100px){
  .pins{
    column-count: 3;
    max-width: 900px;
  }
}

@media (max-width: 820px){
  .pins{
    column-count: 2;
    max-width: 600px;
  }
}

@media (max-width: 520px){
  .pins{
    column-count: 2;
    max-width: 600px;
  }
}

@media (min-width: 2100px){
  .pins{
    column-count: 7;
    max-width: 2100px;
  }
}

@media (min-width: 2400px){
  .pins{
    column-count: 8;
    max-width: 2400px;
  }
}

@media (min-width: 2700px){
  .pins{
    column-count: 9;
    max-width: 2700px;
  }
}

.pin{
  display: inline-block;
  width: 100%;
  margin: 0 0 14px;
  break-inside: avoid;
  background: var(--card-bg);
  border: 1px solid rgba(0,0,0,.08);
  border-radius: 16px;
  overflow: hidden;
  cursor: pointer;
  transition: transform .12s ease, box-shadow .12s ease;
}

.pin:hover{
  transform: translateY(-2px);
  box-shadow: 0 10px 26px rgba(0,0,0,.08);
}

.pin a{ color: inherit; text-decoration: none; }

/* Search cards aligned with Library card anatomy. */
.search-pin{
  background: transparent;
  border: none;
  border-radius: 0;
  overflow: visible;
  box-shadow: none;
}

.search-pin:hover{
  transform: none;
  box-shadow: none;
}

.search-pin-link{
  display: block;
  color: inherit;
  text-decoration: none;
}

.search-pin .pin-preview{
  border-radius: 16px;
  overflow: hidden;
}

.search-pin-media-wrap,
.search-pin-fallback{
  height: 220px;
}

.search-pin .search-pin-media-wrap{
  border: 1px solid var(--border-subtle);
  background: rgba(0,0,0,0.04);
  color: var(--muted-strong);
}

.search-pin .search-pin-media-wrap.preview-failed{
  background: rgba(37,99,235,0.10);
}

.search-pin-img{
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.search-pin-fallback{
  border: 1px solid var(--border-subtle);
  border-radius: 16px;
  font-size: 17px;
  letter-spacing: .08em;
  color: var(--muted-strong);
  background: rgba(37,99,235,0.10);
}

.search-pin .pin-meta{
  padding: 8px 4px 2px;
}

.search-pin-kebab{
  opacity: .45;
  pointer-events: none;
}

.search-pin-snippet{
  margin: 4px 0 0;
  font-size: 12px;
  line-height: 1.35;
  color: var(--muted);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.search-pin-badges{
  margin-top: 8px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.search-pin-badge{
  font-size: 11px;
  padding: 4px 8px;
  border-radius: 999px;
  background: rgba(0,0,0,.06);
  line-height: 1;
}

.pin-top{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
  padding: 10px 12px 8px;
}

.pin-title{
  font-weight: 700;
  font-size: 14px;
  line-height: 1.15;
  margin: 0;
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
}

.pin-sub{
  font-size: 12px;
  opacity: .75;
  margin-top: 2px;
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
}

.pin-badges{
  display:flex;
  gap:6px;
  flex: 0 0 auto;
}

.pin-badge{
  font-size: 11px;
  padding: 4px 8px;
  border-radius: 999px;
  background: rgba(0,0,0,.06);
  white-space: nowrap;
}

.pin-media{
  width:100%;
  display:block;
}

.pin-media img{
  width:100%;
  height:auto;
  display:block;
}

.pin-body{
  padding: 10px 12px 12px;
}

.pin-snippet{
  margin:0;
  font-size: 13px;
  line-height: 1.35;
  opacity:.9;
}

.pin-links{
  margin: 8px 0 0;
  padding-left: 18px;
  font-size: 13px;
  line-height: 1.35;
}

.pin-links li{ margin: 6px 0; }

/* Doorway style for URL-ish pins */
.pin--doorway .pin-media{ display:none; }
.pin--doorway .pin-snippet{ opacity: .95; }

/* Web bundle */
.pin--web .pin-media{ display:none; }
.pin--web .pin-snippet{ opacity:.95; }

/* Skeleton loading */
.pin.skeleton{
  cursor: default;
  position: relative;
  overflow: hidden;
}

.pin.skeleton:hover{ transform:none; box-shadow:none; }

.skel-line{
  height: 12px;
  border-radius: 10px;
  background: rgba(0,0,0,.08);
  margin: 8px 0;
}

.skel-media{
  height: 180px;
  background: rgba(0,0,0,.08);
}

.pin.skeleton:after{
  content:"";
  position:absolute;
  inset:0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.35), transparent);
  transform: translateX(-100%);
  animation: shimmer 1.1s infinite;
}

@keyframes shimmer{
  100%{ transform: translateX(100%); }
}

/* Generic "loading" skin for media elements (signed URLs, lazy fetch, etc.) */
.media-skel{
  background: rgba(0,0,0,.08);
  background-image: linear-gradient(90deg, rgba(0,0,0,.06), rgba(255,255,255,.35), rgba(0,0,0,.06));
  background-size: 200% 100%;
  animation: mediaShimmer 1.1s ease-in-out infinite;
}

@keyframes mediaShimmer{
  0%{ background-position: 200% 0; }
  100%{ background-position: -200% 0; }
}

/* =========================================================
   Web “classic URL page” overlay (Step 9)
   ========================================================= */

.web-page{
  position: fixed;
  inset: 0;
  background: var(--bg);
  z-index: 10000;
  display: none;
  flex-direction: column;
}

.web-page-header{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid rgba(0,0,0,.08);
}

.web-page-actions{
  display:flex;
  align-items:center;
  gap:10px;
}

.web-page-title{
  font-weight: 800;
  font-size: 16px;
  line-height: 1.1;
}

.web-page-query{
  margin-top: 4px;
  font-size: 13px;
  opacity: .75;
  overflow:hidden;
  text-overflow:ellipsis;
  white-space:nowrap;
  max-width: 75vw;
}

.web-page-close{
  border: 1px solid rgba(0,0,0,.10);
  background: var(--card-bg);
  border-radius: 12px;
  width: 40px;
  height: 40px;
  cursor: pointer;
  font-size: 18px;
}

.web-page-body{
  flex: 1;
  overflow: auto;
}

.web-page-list{
  padding: 10px 16px 24px;
}

.web-item{
  padding: 14px 0;
  border-top: 1px solid rgba(0,0,0,.08);
}

.web-item:first-child{ border-top:none; }

.web-item-title{
  margin: 0 0 6px 0;
  font-size: 16px;
  line-height: 1.25;
}

.web-item-domain{
  font-size: 12px;
  opacity: .7;
  margin-bottom: 8px;
}

.web-item-snippet{
  margin: 0;
  opacity: .9;
  line-height: 1.4;
}

.web-empty{
  padding: 18px 0;
  opacity: .75;
}

/* =========================================================
   Home feed header (Step 10)
   ========================================================= */

.feed-header{
  margin-top: 18px;
  padding: 12px 2px 8px;
  display: block;
  text-align: center;
}

.feed-title{
  font-weight: 900;
  font-size: 16px;
}

.feed-sub{
  margin-top: 6px;
  font-size: 13px;
  opacity: .75;
}

.feed-arrow{
  margin-top: 10px;
  font-size: 18px;
  opacity: .6;
}

/* “peek” feel: keep hero roomy so feed begins slightly under the fold */
.brand{
  margin-top: 26px;
}

/* =========================================================
   Waterfall / mural renderer
   ========================================================= */

:root{
  --wf-gap: clamp(6px, 0.75vw, 12px);
  --wf-radius: clamp(10px, 1.1vw, 14px);
  --wf-hair: rgba(0,0,0,0.10);
  --wf-panel: rgba(2,6,23,0.04);
  --wf-panel-strong: rgba(2,6,23,0.08);
}

body.theme-dark{
  --wf-hair: rgba(255,255,255,0.08);
  --wf-panel: rgba(255,255,255,0.03);
  --wf-panel-strong: rgba(255,255,255,0.06);
}

html.wf-is-resizing .wf-tile{
  transition: none !important;
}

.results.waterfall{
  width: 100%;
  max-width: none;
  margin: 0;
}

.results.waterfall .empty{
  margin: 28px auto;
  text-align: center;
  max-width: 56ch;
}

.results.waterfall .wf-empty-wrap{
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.results.waterfall .wf-feed{
  width: min(1400px, calc(100% - 24px));
  margin: 0 auto;
  display: flex;
  flex-direction: column;
}

.wf-section{
  position: relative;
  width: 100%;
  height: clamp(520px, 80vh, 920px);
  overflow: hidden;
  border-bottom: 1px solid var(--wf-hair);
  background:
    radial-gradient(760px 420px at 25% 24%, rgba(6,182,212,0.08), transparent 62%),
    linear-gradient(to bottom, var(--wf-panel-strong), transparent 30%),
    var(--card-bg);
}

body.theme-dark .wf-section{
  background:
    radial-gradient(760px 420px at 25% 24%, rgba(6,182,212,0.12), transparent 62%),
    linear-gradient(to bottom, rgba(255,255,255,0.02), transparent 30%),
    rgba(2,6,23,0.85);
}

.wf-canvas{
  position: absolute;
  inset: 0;
}

.wf-tile{
  position: absolute;
  padding: calc(var(--wf-gap) / 2);
  transition:
    left 520ms cubic-bezier(0.2, 0.8, 0.2, 1),
    top 520ms cubic-bezier(0.2, 0.8, 0.2, 1),
    width 520ms cubic-bezier(0.2, 0.8, 0.2, 1),
    height 520ms cubic-bezier(0.2, 0.8, 0.2, 1),
    opacity 220ms ease,
    transform 220ms ease;
  will-change: left, top, width, height, transform;
}

.wf-tile.enter{
  opacity: 0;
  transform: scale(0.94);
}

.wf-tile.enter.placed{
  opacity: 1;
  transform: scale(1);
}

.wf-tile-link{
  display: block;
  width: 100%;
  height: 100%;
  color: inherit;
  text-decoration: none;
}

.wf-tile-inner{
  width: 100%;
  height: 100%;
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  border-radius: var(--wf-radius);
  overflow: hidden;
  position: relative;
  background: rgba(255,255,255,0.75);
  border: 1px solid rgba(0,0,0,0.06);
  box-shadow: 0 16px 34px rgba(0,0,0,0.12);
}

body.theme-dark .wf-tile-inner{
  background: rgba(15,23,42,0.58);
  border: 1px solid rgba(255,255,255,0.07);
  box-shadow: 0 16px 34px rgba(0,0,0,0.34);
}

.wf-media{
  position: relative;
  min-height: 0;
  overflow: hidden;
  background: var(--wf-panel);
}

.wf-media .mylib-file-hero{
  height: 100%;
  width: 100%;
  font-size: 18px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.results.waterfall .search-pin-media-wrap,
.results.waterfall .search-pin-fallback,
.results.waterfall .wf-media .mylib-file-hero{
  height: 100%;
}

.results.waterfall .search-pin-img{
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.wf-pin-shell .pin-preview{
  height: 100%;
  border-radius: var(--wf-radius) var(--wf-radius) 0 0;
  border: none;
  border-bottom: 1px solid rgba(0,0,0,0.06);
  box-shadow: none;
  transform: none !important;
}

body.theme-dark .wf-pin-shell .pin-preview{
  border-bottom: 1px solid rgba(255,255,255,0.08);
}

.wf-pin-shell .pin-preview:hover{
  transform: none !important;
  box-shadow: none !important;
}

.wf-media img{
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  filter: grayscale(0.10) contrast(1.10);
  transform: scale(1.02);
  opacity: 0.93;
  transition: transform 230ms ease, opacity 230ms ease;
}

.wf-tile:hover .wf-media img{
  transform: scale(1.05);
  opacity: 1;
}

.wf-info{
  position: relative;
  padding: 8px 8px 6px;
  display: flex;
  flex-direction: column;
  gap: 0;
  background: rgba(255,255,255,0.96);
  backdrop-filter: none;
  border-top: none;
}

body.theme-dark .wf-info{
  background: rgba(15,23,42,0.95);
}

.wf-info .pin-meta-top{
  align-items: center;
}

.wf-info .pin-title{
  font-size: 13px;
  line-height: 1.2;
}

.wf-info .pin-sub{
  margin-top: 2px;
}

.wf-info .search-pin-kebab{
  opacity: .45;
  pointer-events: none;
}

.wf-toprow{
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.wf-kind{
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  color: rgba(2,6,23,0.86);
}

body.theme-dark .wf-kind{
  color: rgba(255,255,255,0.86);
}

.wf-tag{
  font-size: 10px;
  font-weight: 850;
  letter-spacing: 0.08em;
  color: rgba(2,6,23,0.78);
  padding: 4px 7px;
  border-radius: 999px;
  background: rgba(2,6,23,0.10);
  border: 1px solid rgba(2,6,23,0.10);
  white-space: nowrap;
}

body.theme-dark .wf-tag{
  color: rgba(255,255,255,0.78);
  background: rgba(255,255,255,0.10);
  border: 1px solid rgba(255,255,255,0.10);
}

.wf-name{
  font-size: 13px;
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -0.02em;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.wf-sub{
  font-size: 11px;
  opacity: 0.8;
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.wf-meta{
  font-size: 11px;
  color: rgba(2,6,23,0.66);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

body.theme-dark .wf-meta{
  color: rgba(255,255,255,0.66);
}

.wf-dot{ opacity: 0.5; }

.wf-tile[data-layout="o"] .wf-tile-inner,
.wf-tile[data-layout="h"] .wf-tile-inner,
.wf-tile[data-layout="v"] .wf-tile-inner{
  display: grid;
  grid-template-columns: 1fr;
  grid-template-rows: minmax(0, 1fr) auto;
}

.wf-tile[data-layout="o"] .wf-media,
.wf-tile[data-layout="h"] .wf-media,
.wf-tile[data-layout="v"] .wf-media{
  position: relative;
  inset: auto;
  height: auto;
}

.wf-tile[data-layout="o"] .wf-info,
.wf-tile[data-layout="h"] .wf-info,
.wf-tile[data-layout="v"] .wf-info{
  position: relative;
  left: auto;
  right: auto;
  bottom: auto;
  border-left: none;
  border-top: none;
  background: rgba(255,255,255,0.96);
}

body.theme-dark .wf-tile[data-layout="o"] .wf-info,
body.theme-dark .wf-tile[data-layout="h"] .wf-info,
body.theme-dark .wf-tile[data-layout="v"] .wf-info{
  background: rgba(15,23,42,0.95);
}

.wf-tile.compact .wf-name{
  -webkit-line-clamp: 1;
  font-size: 12px;
}

.wf-tile.compact .wf-sub{ display: none; }
.wf-tile.compact .wf-meta{ display: none; }

.wf-loading-trigger{
  height: 110px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-size: 12px;
  color: var(--muted);
  width: min(1400px, calc(100% - 24px));
  margin: 0 auto;
  user-select: none;
}

.wf-loading-text{
  letter-spacing: 0.02em;
}

.wf-loading-trigger.is-more{
  cursor: pointer;
}

.wf-spinner{
  width: 14px;
  height: 14px;
  border-radius: 999px;
  border: 2px solid rgba(0,0,0,0.14);
  border-top-color: rgba(6,182,212,0.9);
  animation: wf-spin 900ms linear infinite;
}

body.theme-dark .wf-spinner{
  border-color: rgba(255,255,255,0.14);
  border-top-color: rgba(6,182,212,0.9);
}

@keyframes wf-spin{
  to{ transform: rotate(360deg); }
}

@media (prefers-reduced-motion: reduce){
  .wf-tile{ transition: none; }
  .wf-spinner{ animation: none; }
  .wf-media img{ transition: none; }
}

/* =========================================================
   Waterfall: make pin details behave like original search pins
   (no framed footer under the image)
   ========================================================= */

/* 1) Remove the footer slab */
.results.waterfall .wf-info.pin-meta{
  background: transparent;
  padding: 8px 4px 2px; /* matches original: .search-pin .pin-meta */
}

body.theme-dark .results.waterfall .wf-info.pin-meta{
  background: transparent;
}

/* 2) Remove the "whole tile card" frame so only the preview looks framed */
.results.waterfall .wf-tile-inner.wf-pin-shell{
  background: transparent;
  border: none;
  box-shadow: none;
  border-radius: 0;
  overflow: hidden; /* keep content contained inside the tile rect */
}

/* 3) Restore the preview to look like a standalone rounded block */
.results.waterfall .wf-pin-shell .pin-preview{
  border-radius: 16px;
  overflow: hidden;
  border: none;
  border-bottom: none; /* cancels the wf border-bottom separator */
}

/* 4) Restore the subtle border/background on the media wrapper
      (in original CSS this only applies under .search-pin, but
       waterfall tiles don't carry that class) */
.results.waterfall .search-pin-media-wrap{
  border: 1px solid var(--border-subtle);
  background: rgba(0,0,0,0.04);
  color: var(--muted-strong);
}

.results.waterfall .search-pin-media-wrap.preview-failed{
  background: rgba(37,99,235,0.10);
}
