/* ===== 2026 Portfolio Flip Book ===== */
* { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg-top: #23303e;
  --bg-bottom: #10161d;
  --accent: #e07b2c;      /* orange from the brand */
  --accent-hi: #f2933f;
  --panel: rgba(255,255,255,0.06);
  --panel-hi: rgba(255,255,255,0.14);
  --text: #eef2f6;
}

html, body {
  height: 100%;
  width: 100%;
  overflow: hidden;
}

body {
  background: radial-gradient(ellipse at 50% 20%, var(--bg-top), var(--bg-bottom) 75%);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  display: flex;
  flex-direction: column;
  -webkit-tap-highlight-color: transparent;
}

/* ---- Stage ---- */
#stage {
  flex: 1 1 auto;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px 10px 6px;
  min-height: 0;
  overflow: hidden;   /* keep the book from spilling over the controls */
  z-index: 1;
}

/* #bookFit is a plain wrapper the library never touches. JS (fitBook) caps
   its width so the book's height always fits the viewport; the book fills it
   and its height follows the page aspect ratio. */
#bookFit {
  width: 100%;
  margin: 0 auto;
  display: flex;
  justify-content: center;
}
#book {
  width: 100%;
  touch-action: pan-y;
}

/* page wrappers */
.page {
  background: #efe9dd;
  overflow: hidden;
  box-shadow: inset 0 0 0 1px rgba(0,0,0,0.06);
}
.page img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  -webkit-user-drag: none;
  user-select: none;
}
/* lightweight loading shimmer until the image arrives */
.page:not(.loaded) {
  background:
    linear-gradient(100deg, rgba(255,255,255,0) 30%, rgba(255,255,255,.35) 50%, rgba(255,255,255,0) 70%),
    #e4ddcf;
  background-size: 200% 100%;
  animation: shimmer 1.3s infinite;
}
@keyframes shimmer { to { background-position-x: -200%; } }

.page.--hard { background: #d9d2c4; }

/* ---- Controls ---- */
#controls {
  flex: 0 0 auto;
  position: relative;
  z-index: 30;
  background: var(--bg-bottom);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 10px 14px calc(10px + env(safe-area-inset-bottom));
  user-select: none;
}

.btn {
  appearance: none;
  border: 0;
  background: var(--panel);
  color: var(--text);
  width: 46px; height: 46px;
  border-radius: 50%;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background .15s, transform .1s;
}
.btn:hover { background: var(--panel-hi); }
.btn:active { transform: scale(0.92); }
.btn:disabled { opacity: .3; cursor: default; }

#pageInfo {
  min-width: 118px;
  text-align: center;
  font-variant-numeric: tabular-nums;
  font-size: 14px;
  letter-spacing: .3px;
  padding: 0 6px;
  opacity: .9;
}

/* progress bar under the book */
#progressWrap {
  flex: 0 0 auto;
  position: relative;
  z-index: 30;
  height: 3px;
  width: 100%;
  background: rgba(255,255,255,0.08);
}
#progressBar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--accent), var(--accent-hi));
  transition: width .4s ease;
}

/* ---- Loading overlay ---- */
#loader {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 16px;
  background: var(--bg-bottom);
  z-index: 50;
  transition: opacity .5s;
}
#loader.hidden { opacity: 0; pointer-events: none; }
.spinner {
  width: 44px; height: 44px;
  border: 4px solid rgba(255,255,255,0.15);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
#loader p { font-size: 14px; opacity: .7; letter-spacing: .4px; }

/* hint that fades on first flip */
#hint {
  position: fixed;
  bottom: 74px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0,0,0,0.55);
  padding: 7px 14px;
  border-radius: 20px;
  font-size: 12.5px;
  letter-spacing: .3px;
  pointer-events: none;
  transition: opacity .6s;
  z-index: 20;
}
#hint.hidden { opacity: 0; }

@media (max-width: 640px) {
  #stage { padding: 10px 4px 4px; }
  .btn { width: 42px; height: 42px; font-size: 18px; }
  #pageInfo { min-width: 96px; font-size: 13px; }
}
