/* =========================
   Contos do Navil — Sea UI
   ========================= */

:root{
  --bg0:#031525;
  --bg1:#05314a;
  --ink:#eaf6ff;
  --muted:#a9c7d8;
  --card:rgba(255,255,255,.07);
  --card2:rgba(255,255,255,.10);
  --stroke:rgba(255,255,255,.14);
  --glow:rgba(117, 228, 255, .22);
  --accent:#75e4ff;
  --accent2:#7dffb3;
  --shadow: 0 18px 55px rgba(0,0,0,.45);
  --radius: 18px;
  --font: 17px;
  --line: 1.75;
}

html[data-theme="storm"]{
  --bg0:#070b12;
  --bg1:#1a2330;
  --card:rgba(255,255,255,.06);
  --card2:rgba(255,255,255,.09);
  --stroke:rgba(255,255,255,.12);
  --accent:#b7a0ff;
  --accent2:#7dd7ff;
  --glow:rgba(183,160,255,.22);
}

html[data-theme="dawn"]{
  --bg0:#0b2440;
  --bg1:#1a6ea6;
  --card:rgba(255,255,255,.09);
  --card2:rgba(255,255,255,.13);
  --stroke:rgba(255,255,255,.16);
  --accent:#ffe07d;
  --accent2:#75e4ff;
  --glow:rgba(255,224,125,.22);
}

*{ box-sizing:border-box; }
body{
  margin:0;
  color:var(--ink);
  background:
    radial-gradient(1200px 800px at 12% 10%, rgba(117,228,255,.14), transparent 60%),
    radial-gradient(900px 650px at 88% 15%, rgba(125,255,179,.10), transparent 55%),
    linear-gradient(180deg, var(--bg0), var(--bg1));
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Arial, "Apple Color Emoji", "Segoe UI Emoji";
  min-height:100vh;
  overflow-x:hidden;
}

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

.bg-stars{
  position:fixed; inset:0;
  pointer-events:none;
  background-image:
    radial-gradient(circle at 12% 17%, rgba(255,255,255,.45) 0 1px, transparent 2px),
    radial-gradient(circle at 72% 28%, rgba(255,255,255,.40) 0 1px, transparent 2px),
    radial-gradient(circle at 35% 62%, rgba(255,255,255,.30) 0 1px, transparent 2px),
    radial-gradient(circle at 88% 78%, rgba(255,255,255,.28) 0 1px, transparent 2px),
    radial-gradient(circle at 22% 86%, rgba(255,255,255,.22) 0 1px, transparent 2px);
  opacity:.55;
  filter: blur(.2px);
}

.ocean{
  position:fixed;
  left:-4vw; right:-4vw;
  bottom:-3px;
  height:190px;
  pointer-events:none;
  background: linear-gradient(180deg, transparent, rgba(0,0,0,.18));
}
.ocean::before,
.ocean::after{
  content:"";
  position:absolute; inset:0;
  background-repeat: repeat-x;
  background-size: 1200px 180px;
  opacity:.75;
  filter: drop-shadow(0 -8px 22px rgba(0,0,0,.25));
  transform: translateZ(0);
}
.ocean::before{
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1200 120' preserveAspectRatio='none'><path d='M0,0V46.29c47.79,22,103.59,32.17,158,28c70.36-4.2,136.33-33.42,206.8-37.5c73.84-4.36,147.54,16.88,218.2,35.26c69.27,18,138.3,24.88,209.4,13.08c36.15-6,69.85-17.84,104.45-29.34C1127.1,36.18,1163.1,25.56,1200,22.64V0Z' fill='%23ffffff' opacity='0.14'/></svg>");
  animation: drift 18s linear infinite;
}
.ocean::after{
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1200 120' preserveAspectRatio='none'><path d='M0,0V32.06c67.2,24.32,140.53,38.27,214.4,32.06c66.62-5.63,126.32-30.38,192.4-38.27c73.3-8.74,146.16,9.3,218.2,27.67c70.3,17.93,140.19,25.68,209.4,13.88c65.4-11.15,122.6-37.37,180.6-55.33C1083.2,7.9,1141.6-5.57,1200,2.26V0Z' fill='%23ffffff' opacity='0.10'/></svg>");
  animation: drift2 26s linear infinite;
  opacity:.6;
}

@keyframes drift{
  from{ background-position: 0 0; }
  to{ background-position: 1200px 0; }
}
@keyframes drift2{
  from{ background-position: 1200px 0; }
  to{ background-position: 0 0; }
}

/* Topbar */
.topbar{
  position:sticky;
  top:0;
  z-index:30;
  display:flex;
  align-items:center;
  gap:14px;
  padding:14px 16px;
  background: linear-gradient(180deg, rgba(3,21,37,.92), rgba(3,21,37,.72));
  backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(255,255,255,.10);
}

.iconbtn{
  width:44px;height:44px;
  display:grid;place-items:center;
  border-radius: 14px;
  border:1px solid var(--stroke);
  background: rgba(255,255,255,.06);
  color:var(--ink);
  box-shadow: 0 10px 26px rgba(0,0,0,.25);
  cursor:pointer;
}
.iconbtn:active{ transform: translateY(1px); }

.brand{
  display:flex;
  align-items:center;
  gap:10px;
  min-width: 0;
}
.brand-mark{
  width:40px;height:40px;
  display:grid;place-items:center;
  border-radius: 14px;
  background: radial-gradient(circle at 30% 30%, rgba(117,228,255,.35), rgba(255,255,255,.05));
  border:1px solid rgba(255,255,255,.14);
  box-shadow: 0 18px 55px rgba(0,0,0,.3);
}
.brand-title{
  font-weight: 750;
  letter-spacing:.2px;
  line-height:1.05;
}
.brand-sub{
  font-size: 12px;
  color: var(--muted);
  margin-top: 2px;
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
}
.top-actions{
  margin-left:auto;
  display:flex;
  gap:8px;
  flex-wrap:wrap;
  justify-content:flex-end;
}

.pill{
  border-radius: 999px;
  border:1px solid var(--stroke);
  background: rgba(255,255,255,.06);
  color: var(--ink);
  padding:10px 12px;
  font-weight: 650;
  cursor:pointer;
  box-shadow: 0 10px 26px rgba(0,0,0,.22);
}
.pill:hover{ border-color: rgba(255,255,255,.20); }
.pill:active{ transform: translateY(1px); }

/* Shell layout */
.shell{
  max-width: 1220px;
  margin: 0 auto;
  padding: 18px 16px 64px;
  display:grid;
  grid-template-columns: 360px 1fr;
  gap: 16px;
}

.sidebar{
  position: sticky;
  top: 84px;
  align-self: start;
  max-height: calc(100vh - 104px);
  border-radius: var(--radius);
  background: rgba(255,255,255,.045);
  border:1px solid rgba(255,255,255,.10);
  box-shadow: var(--shadow);
  overflow:hidden;
}

.sidebar-head{
  padding: 16px;
  background: linear-gradient(180deg, rgba(255,255,255,.06), rgba(255,255,255,.03));
  border-bottom:1px solid rgba(255,255,255,.10);
}

.kicker{
  font-size:12px;
  color:var(--muted);
  letter-spacing:.18em;
  text-transform:uppercase;
  margin-bottom:10px;
}

.search{
  position:relative;
  display:block;
  margin-bottom: 10px;
}
.search input{
  width:100%;
  border-radius: 14px;
  border:1px solid rgba(255,255,255,.14);
  background: rgba(0,0,0,.14);
  color: var(--ink);
  padding: 12px 42px 12px 12px;
  outline:none;
}
.search input::placeholder{ color: rgba(234,246,255,.55); }
.search-ico{
  position:absolute;
  right:12px; top:50%;
  transform: translateY(-50%);
  opacity:.7;
}

.filters{
  display:grid;
  grid-template-columns: 1fr 1fr;
  gap:8px;
}
select{
  border-radius: 14px;
  border:1px solid rgba(255,255,255,.14);
  background: rgba(0,0,0,.14);
  color: var(--ink);
  padding: 10px 10px;
  outline:none;
}

.list{
  padding: 10px;
  overflow:auto;
  max-height: calc(100vh - 300px);
}
.item{
  display:flex;
  gap:10px;
  padding: 12px;
  border-radius: 16px;
  border:1px solid rgba(255,255,255,.10);
  background: rgba(255,255,255,.04);
  cursor:pointer;
  margin-bottom:10px;
  transition: transform .12s ease, border-color .12s ease, background .12s ease;
}
.item:hover{
  transform: translateY(-1px);
  border-color: rgba(255,255,255,.18);
  background: rgba(255,255,255,.06);
}
.item.active{
  border-color: rgba(117,228,255,.35);
  box-shadow: 0 0 0 2px rgba(117,228,255,.16);
}

.badge{
  min-width:42px;
  height:42px;
  display:grid;
  place-items:center;
  border-radius: 14px;
  border:1px solid rgba(255,255,255,.14);
  background: radial-gradient(circle at 30% 30%, rgba(117,228,255,.22), rgba(255,255,255,.03));
  color: var(--ink);
  font-weight: 800;
  letter-spacing:.02em;
}

.item-body{
  min-width:0;
}
.item-title{
  font-weight: 780;
  line-height:1.2;
}
.item-meta{
  margin-top:4px;
  font-size: 12px;
  color: var(--muted);
  display:flex;
  gap:8px;
  flex-wrap:wrap;
}
.tag{
  padding: 2px 8px;
  border-radius: 999px;
  border:1px solid rgba(255,255,255,.12);
  background: rgba(0,0,0,.10);
}
.readmark{
  margin-left:auto;
  opacity:.9;
  filter: drop-shadow(0 6px 14px rgba(0,0,0,.22));
}

.sidebar-foot{
  padding: 12px 16px 16px;
  border-top:1px solid rgba(255,255,255,.10);
  background: linear-gradient(180deg, rgba(255,255,255,.02), rgba(0,0,0,.12));
}

.tiny{
  font-size: 12px;
  color: rgba(234,246,255,.70);
  line-height: 1.45;
}
.hint{ margin-top: 8px; opacity:.8; }

/* Reader */
.reader{
  min-height: 70vh;
}
.reader-card{
  border-radius: var(--radius);
  background: rgba(255,255,255,.055);
  border:1px solid rgba(255,255,255,.10);
  box-shadow: var(--shadow);
  overflow:hidden;
}
.reader-top{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap: 12px;
  padding: 18px 18px 10px;
  background: linear-gradient(180deg, rgba(255,255,255,.06), rgba(255,255,255,.02));
}
.reader-kicker{
  color: var(--muted);
  font-size: 12px;
  letter-spacing:.14em;
  text-transform: uppercase;
  margin-bottom: 8px;
}
.reader-title{
  margin:0;
  font-size: clamp(22px, 2.2vw, 34px);
  line-height:1.1;
  letter-spacing:.2px;
}
.reader-actions{
  display:flex;
  gap:8px;
  flex-wrap:wrap;
  justify-content:flex-end;
}

.divider{
  height:1px;
  background: rgba(255,255,255,.10);
}

.reader-body{
  padding: 16px 18px 18px;
  font-size: var(--font);
  line-height: var(--line);
  color: rgba(234,246,255,.92);
}
.reader-body code{
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  font-size: .92em;
  background: rgba(0,0,0,.18);
  border:1px solid rgba(255,255,255,.10);
  padding: 2px 6px;
  border-radius: 10px;
}
.reader-body p{ margin: 0 0 14px; }
.reader-body p:last-child{ margin-bottom:0; }
.reader-body hr{
  border:0;
  height:1px;
  background: rgba(255,255,255,.14);
  margin: 18px 0;
}
.reader-body blockquote{
  margin: 14px 0;
  padding: 12px 14px;
  border-radius: 16px;
  border:1px solid rgba(255,255,255,.12);
  background: rgba(0,0,0,.14);
  color: rgba(234,246,255,.88);
}
.dropcap::first-letter{
  float:left;
  font-size: 3.2em;
  line-height: .85;
  padding-right: .14em;
  margin-top: .06em;
  color: var(--accent);
  text-shadow: 0 16px 45px var(--glow);
  font-weight: 900;
}

.footer{
  margin-top: 12px;
  padding: 10px 6px 0;
  text-align:center;
}

/* Mobile */
@media (max-width: 940px){
  .shell{ grid-template-columns: 1fr; }
  .sidebar{
    position:fixed;
    inset: 72px 12px 12px 12px;
    max-height: unset;
    transform: translateY(8px);
    opacity:0;
    pointer-events:none;
    transition: opacity .14s ease, transform .14s ease;
  }
  .sidebar.open{
    opacity:1;
    transform: translateY(0);
    pointer-events:auto;
  }
  .list{ max-height: calc(100vh - 260px); }
}




/* =========================
   Bootstrap polish + design virtues
   ========================= */

/* Better base typography (works with Bootstrap too) */
:root{
  --radius-xl: 22px;
  --radius-lg: 18px;
  --radius-md: 14px;
  --radius-sm: 12px;
  --ring: 0 0 0 3px rgba(117,228,255,.22);
  --ring2: 0 0 0 3px rgba(125,255,179,.20);
}

body{
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "Apple Color Emoji", "Segoe UI Emoji";
  letter-spacing: .2px;
}

/* Smooth focus for keyboard users */
:focus-visible{
  outline: none;
  box-shadow: var(--ring);
  border-radius: 12px;
}

/* Improve scrollbars */
*{
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,.20) rgba(0,0,0,.20);
}
*::-webkit-scrollbar{ width: 10px; height:10px; }
*::-webkit-scrollbar-thumb{
  background: rgba(255,255,255,.16);
  border-radius: 99px;
  border: 2px solid rgba(0,0,0,.20);
}
*::-webkit-scrollbar-track{
  background: rgba(0,0,0,.18);
  border-radius: 99px;
}

/* Bootstrap components — sea-glass style */
.btn, .form-control, .form-select, .input-group-text{
  border-radius: 999px;
}
.btn-primary{
  background: linear-gradient(135deg, rgba(117,228,255,.95), rgba(125,255,179,.85));
  border: 0;
  color: #062033;
  font-weight: 700;
  box-shadow: 0 14px 36px rgba(0,0,0,.35);
}
.btn-primary:hover{ filter: brightness(1.04); transform: translateY(-1px); }
.btn-primary:active{ transform: translateY(0); }

.form-control, .form-select{
  background: rgba(255,255,255,.08);
  border: 1px solid rgba(255,255,255,.14);
  color: var(--ink);
}
.form-control::placeholder{ color: rgba(233,246,255,.58); }
.form-control:focus, .form-select:focus{
  background: rgba(255,255,255,.10);
  border-color: rgba(117,228,255,.45);
  box-shadow: var(--ring);
  color: var(--ink);
}

/* Make cards look premium even if Bootstrap is used later */
.card{
  background: rgba(255,255,255,.06);
  border: 1px solid rgba(255,255,255,.14);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
}

/* Tiny micro-interactions */
.iconbtn, .item, .pill, .toggle, .btn{
  transition: transform .14s ease, filter .14s ease, background .18s ease, border-color .18s ease;
}

/* Reader comfort: increase line-height, better measure */
.reader{
  max-width: 78ch;
  margin-inline: auto;
}
.reader #content{
  line-height: 1.75;
  font-size: clamp(1.02rem, 1.2vw, 1.1rem);
}
.reader blockquote{
  border-left-width: 4px;
  border-left-color: rgba(125,255,179,.65);
  background: rgba(0,0,0,.18);
}

/* Sidebar badge: make "Conto N" pop */
.badge{
  font-weight: 800;
  letter-spacing: .6px;
  border-radius: 14px;
  padding: 8px 10px;
  min-width: 82px;
  text-align: center;
}

/* Chapter filter dropdown gets a little nicer */
select, input{
  accent-color: var(--accent);
}

/* Subtle vignette for cinematic depth */
body::after{
  content:"";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(1200px 700px at 50% 20%, transparent 40%, rgba(0,0,0,.34) 90%);
  mix-blend-mode: multiply;
  opacity: .55;
}

/* Respect reduced motion */
@media (prefers-reduced-motion: reduce){
  *{ animation-duration: 1ms !important; animation-iteration-count: 1 !important; transition-duration: 1ms !important; scroll-behavior: auto !important; }
}
