/* ===========================================================
   AYZ İNŞAAT — Dijital Katalog
   Dark + gold flipbook viewer
   =========================================================== */
:root{
  --bg:        #0c0d10;
  --bg-2:      #121419;
  --panel:     rgba(20,22,28,.82);
  --panel-solid:#14161b;
  --line:      rgba(255,255,255,.08);
  --gold:      #e4b73c;
  --gold-soft: #f0cf6e;
  --gold-dim:  rgba(228,183,60,.16);
  --text:      #e9eaed;
  --muted:     #9aa1ab;
  --muted-2:   #6b7079;
  --radius:    12px;
  --shadow:    0 18px 50px rgba(0,0,0,.55);
  --tbar-h:    58px;
  --bbar-h:    56px;
}

*{box-sizing:border-box;margin:0;padding:0}
html,body{height:100%}
body{
  background:var(--bg);
  color:var(--text);
  font-family:"Inter",system-ui,-apple-system,"Segoe UI",Roboto,sans-serif;
  overflow:hidden;
  -webkit-font-smoothing:antialiased;
}

#app{
  position:fixed; inset:0;
  display:flex; flex-direction:column;
  background:
    radial-gradient(1200px 700px at 50% -10%, #1a1d24 0%, rgba(26,29,36,0) 60%),
    var(--bg);
}

/* ---------- Top bar ---------- */
.topbar{
  height:var(--tbar-h);
  flex:0 0 auto;
  display:flex; align-items:center; justify-content:space-between;
  padding:0 16px;
  background:var(--panel);
  backdrop-filter:blur(14px);
  -webkit-backdrop-filter:blur(14px);
  border-bottom:1px solid var(--line);
  z-index:30;
}
.brand{display:flex; align-items:center; gap:9px; min-width:0;}
.brand-mark{
  font-weight:800; letter-spacing:.06em; font-size:19px;
  color:var(--gold);
}
.brand-name{font-weight:700; letter-spacing:.16em; font-size:15px; color:var(--text);}
.brand-sep{width:1px; height:20px; background:var(--line); margin:0 4px;}
.brand-sub{font-size:13px; color:var(--muted); font-weight:500; letter-spacing:.02em;}

.tools{display:flex; align-items:center; gap:4px;}
.tdivider{width:1px; height:24px; background:var(--line); margin:0 6px;}
.zoom-label{
  font-size:12px; color:var(--muted); min-width:42px; text-align:center;
  font-variant-numeric:tabular-nums; user-select:none;
}

.tbtn{
  display:inline-flex; align-items:center; justify-content:center;
  width:40px; height:40px; border-radius:10px;
  background:transparent; border:1px solid transparent;
  color:var(--text); cursor:pointer; text-decoration:none;
  transition:background .18s, border-color .18s, color .18s, transform .12s;
}
.tbtn:hover{background:rgba(255,255,255,.06); border-color:var(--line);}
.tbtn:active{transform:translateY(1px);}
.tbtn.active{background:var(--gold-dim); border-color:rgba(228,183,60,.4); color:var(--gold-soft);}
.tbtn svg{width:20px; height:20px; fill:none; stroke:currentColor; stroke-width:1.9; stroke-linecap:round; stroke-linejoin:round;}

/* ---------- Stage ---------- */
.stage{
  position:relative; flex:1 1 auto; min-height:0;
  display:flex; align-items:center; justify-content:center;
  padding:22px 70px;
  overflow:hidden;
}
.book-wrap{
  position:relative;
  width:100%; height:100%;
  display:flex; align-items:center; justify-content:center;
  touch-action:none;            /* we handle flip (StPageFlip), pinch & pan ourselves */
  transition:transform .25s cubic-bezier(.22,.61,.36,1);
  will-change:transform;
}
.book-wrap.panning{transition:none; cursor:grabbing;}
.book-wrap.zoomed{cursor:grab;}
#book{margin:0 auto;}
.stf__parent{margin:0 auto; filter:drop-shadow(0 24px 44px rgba(0,0,0,.55)); max-width:var(--pw, none) !important;}
.stf__item{background:#15171c;}
.page{width:100%; height:100%; background:#15171c; overflow:hidden;}
.page img{
  width:100%; height:100%; object-fit:cover; display:block;
  -webkit-user-drag:none; user-select:none; pointer-events:none;
}

/* nav arrows */
.navarrow{
  position:absolute; top:50%; transform:translateY(-50%);
  width:48px; height:48px; border-radius:50%;
  display:flex; align-items:center; justify-content:center;
  background:var(--panel); backdrop-filter:blur(10px);
  border:1px solid var(--line); color:var(--text);
  cursor:pointer; z-index:20;
  transition:background .18s, color .18s, opacity .2s, transform .12s;
}
.navarrow:hover{background:var(--gold); color:#1a1408; border-color:var(--gold);}
.navarrow:active{transform:translateY(-50%) scale(.94);}
.navarrow.prev{left:14px;}
.navarrow.next{right:14px;}
.navarrow svg{width:24px; height:24px; fill:none; stroke:currentColor; stroke-width:2.2; stroke-linecap:round; stroke-linejoin:round;}
.navarrow[disabled]{opacity:.28; pointer-events:none;}

/* ---------- Bottom bar ---------- */
.bottombar{
  height:var(--bbar-h); flex:0 0 auto;
  display:flex; align-items:center; gap:16px;
  padding:0 22px;
  background:var(--panel); backdrop-filter:blur(14px);
  border-top:1px solid var(--line);
  z-index:30;
}
.counter{font-size:13px; color:var(--muted); font-variant-numeric:tabular-nums; user-select:none; white-space:nowrap;}
.counter #curPage{color:var(--gold); font-weight:700;}
.counter .slash{margin:0 5px; color:var(--muted-2);}

#slider{
  -webkit-appearance:none; appearance:none;
  flex:1; height:4px; border-radius:4px; cursor:pointer;
  background:linear-gradient(to right, var(--gold) var(--fill,4%), rgba(255,255,255,.12) var(--fill,4%));
}
#slider::-webkit-slider-thumb{
  -webkit-appearance:none; width:16px; height:16px; border-radius:50%;
  background:var(--gold); border:3px solid var(--bg-2);
  box-shadow:0 0 0 1px var(--gold); cursor:grab; transition:transform .12s;
}
#slider::-webkit-slider-thumb:active{transform:scale(1.2); cursor:grabbing;}
#slider::-moz-range-thumb{
  width:14px; height:14px; border-radius:50%; background:var(--gold);
  border:3px solid var(--bg-2); cursor:grab;
}

/* ---------- Thumbnails drawer ---------- */
.thumbs{
  position:absolute; top:0; right:0; bottom:0;
  width:300px; max-width:84vw;
  background:var(--panel-solid);
  border-left:1px solid var(--line);
  transform:translateX(100%);
  transition:transform .32s cubic-bezier(.22,.61,.36,1);
  z-index:60; display:flex; flex-direction:column;
}
.thumbs.open{transform:translateX(0);}
.thumbs-head{
  display:flex; align-items:center; justify-content:space-between;
  padding:14px 16px; font-weight:600; font-size:14px;
  border-bottom:1px solid var(--line); flex:0 0 auto;
}
.thumbs-grid{
  flex:1; overflow-y:auto; padding:14px;
  display:grid; grid-template-columns:1fr; gap:12px;
}
.thumb{
  position:relative; border-radius:8px; overflow:hidden; cursor:pointer;
  border:2px solid transparent; background:#0e1014;
  transition:border-color .18s, transform .12s;
  aspect-ratio:16/9;
}
.thumb img{width:100%; height:100%; object-fit:cover; display:block; opacity:.85; transition:opacity .18s;}
.thumb:hover img{opacity:1;}
.thumb:hover{transform:translateY(-2px);}
.thumb.active{border-color:var(--gold);}
.thumb .num{
  position:absolute; left:6px; bottom:6px;
  font-size:11px; font-weight:600; color:#fff;
  background:rgba(0,0,0,.6); padding:1px 7px; border-radius:20px;
  backdrop-filter:blur(4px);
}
.thumb.active .num{background:var(--gold); color:#1a1408;}

.scrim{
  position:absolute; inset:0; background:rgba(0,0,0,.5);
  opacity:0; pointer-events:none; transition:opacity .3s; z-index:50;
}
.scrim.show{opacity:1; pointer-events:auto;}

/* ---------- Loader ---------- */
.loader{
  position:absolute; inset:0; z-index:90;
  display:flex; flex-direction:column; align-items:center; justify-content:center; gap:14px;
  background:var(--bg);
  transition:opacity .5s;
}
.loader.hide{opacity:0; pointer-events:none;}
.ring{
  width:52px; height:52px; border-radius:50%;
  border:3px solid rgba(255,255,255,.1);
  border-top-color:var(--gold);
  animation:spin .9s linear infinite;
}
@keyframes spin{to{transform:rotate(360deg)}}
.loader-brand{font-weight:800; letter-spacing:.14em; color:var(--gold); font-size:17px; margin-top:4px;}
.loader-sub{font-size:13px; color:var(--muted);}

/* ---------- Toast ---------- */
.toast{
  position:absolute; left:50%; bottom:78px; transform:translateX(-50%) translateY(12px);
  background:var(--panel-solid); border:1px solid var(--line);
  color:var(--text); font-size:13px; padding:10px 16px; border-radius:10px;
  box-shadow:var(--shadow); opacity:0; pointer-events:none;
  transition:opacity .25s, transform .25s; z-index:95; white-space:nowrap;
}
.toast.show{opacity:1; transform:translateX(-50%) translateY(0);}

/* ---------- Rotate hint (portrait phones) ---------- */
.rotate-hint{
  position:absolute; left:50%; bottom:calc(var(--bbar-h) + 14px);
  transform:translateX(-50%) translateY(10px);
  display:none; align-items:center; gap:10px;
  background:var(--panel-solid); border:1px solid var(--line); color:var(--text);
  padding:9px 10px 9px 14px; border-radius:30px; font-size:13px;
  box-shadow:var(--shadow); z-index:70; opacity:0; max-width:92vw;
  transition:opacity .3s, transform .3s;
}
.rotate-hint.show{display:flex; opacity:1; transform:translateX(-50%) translateY(0);}
.rotate-hint svg{width:22px; height:22px; flex:0 0 auto; fill:none; stroke:var(--gold); stroke-width:1.7; stroke-linecap:round; stroke-linejoin:round;}
.rotate-hint b{color:var(--gold-soft); font-weight:600;}
.rotate-hint button{background:transparent; border:0; color:var(--muted); font-size:15px; cursor:pointer; padding:2px 6px; line-height:1;}
.rotate-hint button:hover{color:var(--text);}

/* ---------- Rotated mode (portrait phone: page rotated 90° to fill screen) ---------- */
#app.rotated-mode #btnZoomIn,
#app.rotated-mode #btnZoomOut,
#app.rotated-mode .zoom-label,
#app.rotated-mode #btnPlay,
#app.rotated-mode .tools .tdivider{display:none;}

/* ---------- Responsive ---------- */
@media (max-width:760px){
  :root{--tbar-h:54px;}
  .stage{padding:10px 8px;}
  .brand-name,.brand-sep,.brand-sub{display:none;}
  .navarrow{width:42px; height:42px;}
  .navarrow.prev{left:6px;} .navarrow.next{right:6px;}
  .zoom-label{display:none;}
  .tbtn{width:40px; height:40px;}
  #btnPlay{display:none;}
}
@media (max-width:440px){
  .tdivider{margin:0 2px;}
  .tbtn{width:34px; height:34px;}
  .tbtn svg{width:18px; height:18px;}
  .bottombar{padding:0 14px; gap:10px;}
}

/* fullscreen tweak */
:fullscreen #app, #app:fullscreen{background:var(--bg);}
