:root{
  --bg: #f6f8ff;
  --bg2:#eef2ff;
  --text:#0b1220;
  --muted:#5b657a;

  --glass: rgba(255,255,255,.60);
  --glass2: rgba(255,255,255,.38);
  --border: rgba(15,23,42,.10);
  --shadow: 0 18px 45px rgba(15,23,42,.12);

  --primary:#2e5bff;
  --primary2:#7c3aed;

  --radius: 22px;
}

*{ box-sizing:border-box; }
html,body{ height:100%; }
body{
  margin:0;
  font-family: Inter, system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  color: var(--text);
  background: linear-gradient(180deg, var(--bg), var(--bg2));
  overflow-x:hidden;
}

a{ color:inherit; text-decoration:none; }
a:hover{ text-decoration:underline; }

.container{
  width: min(1180px, calc(100% - 44px));
  margin: 0 auto;
}

.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;
}

/* BACKGROUND */
.bg{ position:fixed; inset:0; pointer-events:none; z-index:-1; }
.orb{ position:absolute; filter: blur(40px); opacity:.55; transform: translateZ(0); border-radius: 999px; }
.o1{ width:520px; height:520px; left:-180px; top:-180px; background: radial-gradient(circle at 30% 30%, rgba(46,91,255,.55), transparent 60%); }
.o2{ width:520px; height:520px; right:-200px; top:-140px; background: radial-gradient(circle at 30% 30%, rgba(124,58,237,.45), transparent 60%); }
.o3{ width:420px; height:420px; left:35%; bottom:-220px; background: radial-gradient(circle at 30% 30%, rgba(99,102,241,.35), transparent 60%); }
.grain{
  position:absolute; inset:0;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)' opacity='.18'/%3E%3C/svg%3E");
  opacity:.10;
  mix-blend-mode:multiply;
}

/* GLASS */
.glass{
  background: linear-gradient(180deg, var(--glass), var(--glass2));
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  border-radius: var(--radius);
  backdrop-filter: blur(16px);
}

/* HEADER */
.header{
  padding: 18px 0 10px; /* mais compacto => menos scroll */
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap: 14px;
}
.brand{ display:flex; align-items:center; gap: 12px; }
.brand-logo{ width: 44px; height:44px; object-fit:contain; filter: drop-shadow(0 10px 18px rgba(15,23,42,.14)); }
.brand-title{ font-weight: 800; letter-spacing: -.02em; }
.brand-subtitle{ margin-top:2px; font-size: 13px; color: var(--muted); }
.nav{ display:flex; gap: 10px; }
.nav-link{
  padding: 10px 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,.30);
  color: rgba(11,18,32,.88);
}
.nav-link:hover{ text-decoration:none; background: rgba(255,255,255,.50); }

/* TOPBAR */
.topbar{
  display:flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  padding: 2px 0 10px; /* compacto */
  flex-wrap: wrap;
}
.kicker{ font-size: 12px; letter-spacing: .18em; text-transform: uppercase; color: rgba(11,18,32,.55); }
.headline{ margin-top: 6px; font-weight: 800; font-size: clamp(16px, 2.1vw, 22px); letter-spacing: -.02em; }
.topbar-right{ width: min(980px, 100%); padding: 10px; }
.toolbar{ display:flex; align-items:center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }

/* segmented */
.segmented{
  display:flex; gap: 8px; flex-wrap: wrap;
  padding: 6px; border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,.20);
}
.seg-btn{
  border: 1px solid transparent;
  background: transparent;
  color: rgba(11,18,32,.65);
  padding: 8px 12px;
  border-radius: 999px;
  cursor:pointer;
  font-weight: 700;
  font-size: 13px;
  transition: .15s ease;
  white-space: nowrap;
}
.seg-btn:hover{ background: rgba(255,255,255,.45); }
.seg-btn.active{
  color: #fff;
  background: linear-gradient(90deg, var(--primary), var(--primary2));
  box-shadow: 0 14px 26px rgba(46,91,255,.20);
}

/* search */
.search input{
  width: min(320px, 72vw);
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,.35);
  color: var(--text);
  outline:none;
}
.search input:focus{ background: rgba(255,255,255,.55); box-shadow: 0 0 0 4px rgba(46,91,255,.12); }

/* actions */
.tool-actions{ display:flex; align-items:center; gap: 10px; flex-wrap: wrap; margin-left: auto; }
.count{ font-size: 13px; color: rgba(11,18,32,.60); }
.carousel-controls{ display:flex; gap: 10px; }
.icon-btn{
  width: 42px; height:42px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,.35);
  color: rgba(11,18,32,.85);
  cursor:pointer;
  font-size: 22px;
  display:flex; align-items:center; justify-content:center;
  transition: .15s ease;
}
.icon-btn:hover{ background: rgba(255,255,255,.55); }
.icon-btn:disabled{ opacity:.45; cursor:not-allowed; }

.pill-btn{
  border: 1px solid var(--border);
  background: rgba(255,255,255,.35);
  color: rgba(11,18,32,.78);
  padding: 10px 12px;
  border-radius: 999px;
  font-weight: 800;
  cursor:pointer;
}
.pill-btn:hover{ background: rgba(255,255,255,.55); }

/* VIEWER */
.viewer{ padding: 12px; margin-top: 8px; }
.viewer-head{
  display:grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items:start;
  margin-bottom: 10px;
}
.viewer-title{ margin:0; font-weight: 800; letter-spacing: -.02em; font-size: 18px; }
.viewer-sub{ margin: 6px 0 0; color: var(--muted); font-size: 13px; line-height: 1.55; }
.viewer-meta{ display:flex; justify-content:flex-end; gap: 8px; flex-wrap: wrap; }
.tag{
  font-size: 12px;
  color: rgba(11,18,32,.72);
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,.32);
  white-space: nowrap;
}
.viewer-actions{
  grid-column: 2;
  display:flex;
  gap: 10px;
  justify-content:flex-end;
  flex-wrap: wrap;
}
.btn{
  border: 1px solid var(--border);
  background: rgba(255,255,255,.35);
  color: rgba(11,18,32,.90);
  padding: 10px 12px;
  border-radius: 999px;
  font-weight: 800;
  cursor:pointer;
}
.btn:hover{ background: rgba(255,255,255,.55); }
.btn-primary{
  border: 0;
  color: #fff;
  background: linear-gradient(90deg, var(--primary), var(--primary2));
  box-shadow: 0 14px 26px rgba(46,91,255,.18);
}
.btn-primary:hover{ filter: brightness(1.03); }

.viewer-frame-wrap{
  border-radius: calc(var(--radius) - 6px);
  overflow:hidden;
  border: 1px solid rgba(15,23,42,.08);
  background: rgba(255,255,255,.20);
}
/* MAIS RESPONSIVO / MENOS SCROLL */
.viewer-frame{
  width: 100%;
  height: clamp(360px, 56vh, 620px);
  border:0;
  background: transparent;
}

/* CAROUSEL */
.carousel-wrap{ margin-top: 12px; }
.carousel{ padding: 10px; }
.carousel-track{
  display:grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(260px, 1fr);
  gap: 12px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  padding: 4px 4px 10px;
  outline: none;
  scrollbar-width: thin;
  scrollbar-color: rgba(11,18,32,.25) transparent;
}
.carousel-track::-webkit-scrollbar{ height: 10px; }
.carousel-track::-webkit-scrollbar-thumb{ background: rgba(11,18,32,.22); border-radius: 999px; }
.tile{
  scroll-snap-align: start;
  border-radius: 18px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,.32);
  padding: 12px;
  cursor: pointer;
  transition: .15s ease;
  display:grid;
  gap: 10px;
}
.tile:hover{ background: rgba(255,255,255,.52); transform: translateY(-1px); }
.tile.active{
  background: rgba(255,255,255,.72);
  box-shadow: 0 16px 38px rgba(46,91,255,.10);
  border-color: rgba(46,91,255,.22);
}
.tile-top{ display:flex; align-items:flex-start; justify-content:space-between; gap: 10px; }
.tile-title{ margin:0; font-weight: 800; letter-spacing: -.02em; font-size: 14px; line-height: 1.25; }
.tile-cat{
  font-size: 12px; color: rgba(11,18,32,.60);
  padding: 6px 10px; border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,.35);
  white-space: nowrap;
}
.tile-desc{ margin:0; color: rgba(11,18,32,.62); font-size: 12px; line-height: 1.5; }
.hint{ margin-top: 8px; font-size: 12px; }

/* FOOTER */
.footer{
  margin: 18px 0 24px;
  padding-top: 14px;
  border-top: 1px solid rgba(15,23,42,.10);
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap: 12px;
  color: rgba(11,18,32,.60);
  font-size: 13px;
}
.muted{ color: rgba(11,18,32,.58); }

/* MODAL */
.modal{ position: fixed; inset: 0; display: none; z-index: 50; }
.modal[aria-hidden="false"]{ display:block; }
.modal-backdrop{ position:absolute; inset:0; background: rgba(11,18,32,.35); backdrop-filter: blur(6px); }
.modal-panel{
  position: relative;
  width: min(1200px, calc(100% - 24px));
  height: min(90vh, 900px);
  margin: 4vh auto 0;
  padding: 12px;
}
.modal-head{ display:flex; align-items:center; justify-content:space-between; gap: 10px; padding: 6px 6px 10px; }
.modal-title{ font-weight: 800; letter-spacing: -.02em; }
.modal-frame{
  width: 100%;
  height: calc(100% - 58px);
  border: 0;
  border-radius: 16px;
  background: rgba(255,255,255,.20);
  border: 1px solid rgba(15,23,42,.08);
}

/* RESPONSIVO */
@media (max-width: 960px){
  .viewer-head{ grid-template-columns: 1fr; }
  .viewer-actions{ grid-column: 1; justify-content:flex-start; }
  .viewer-meta{ justify-content:flex-start; }
  .tool-actions{ margin-left: 0; }
  .carousel-track{ grid-auto-columns: minmax(240px, 1fr); }
  .viewer-frame{ height: clamp(320px, 50vh, 560px); }
}
@media (max-width: 520px){
  .search input{ width: 100%; }
  .topbar-right{ padding: 10px; }
  .viewer-frame{ height: clamp(300px, 46vh, 520px); }
}
