/* Sita Kuo — Selected Works 2026 flipbook */
:root {
  --bg: #f3f2f0;
  --ink: #2a2826;
  --muted: #7a756e;
  --line: #d8d4ce;
  --btn-bg: rgba(255,255,255,0.55);
  --shadow: rgba(42, 36, 28, 0.18);
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --header-h: 56px;
  --bar-h: 64px;
}

*, *::before, *::after { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  height: 100dvh;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
  overscroll-behavior: none;
  -webkit-tap-highlight-color: transparent;
}

body {
  display: flex;
  flex-direction: column;
  padding-top: var(--safe-top);
  padding-bottom: var(--safe-bottom);
}

.header {
  flex: 0 0 auto;
  min-height: var(--header-h);
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 22px 10px;
  border-bottom: 1px solid var(--line);
  position: relative;
  z-index: 3;
}

.brand {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px 14px;
  min-width: 0;
}

.brand h1 {
  margin: 0;
  font-family: Palatino, "Palatino Linotype", "Book Antiqua", "Songti SC", Georgia, serif;
  font-weight: 500;
  font-size: 17px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  line-height: 1.3;
}

.brand .sub {
  font-family: Palatino, "Palatino Linotype", Georgia, serif;
  font-size: 13px;
  font-style: italic;
  color: var(--muted);
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.download {
  flex: 0 0 auto;
  color: var(--ink);
  text-decoration: none;
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  border-bottom: 1px solid var(--ink);
  padding-bottom: 1px;
  line-height: 1.2;
}
.download:hover { opacity: 0.65; }

.stage {
  flex: 1 1 auto;
  position: relative;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px 20px;
}

#book-shell {
  position: relative;
  z-index: 1;
  flex: 0 0 auto;
  box-shadow:
    0 18px 50px var(--shadow),
    0 2px 8px rgba(42, 36, 28, 0.08);
  background: #efece8;
}

#book.stf__parent,
#book {
  width: 100% !important;
  height: 100% !important;
  min-width: 0 !important;
  max-width: none !important;
  min-height: 0 !important;
  position: relative;
}

#book .stf__wrapper {
  width: 100%;
  height: 100%;
  position: relative;
}

#book canvas { display: block; }

.loader {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  color: var(--muted);
  font-family: Palatino, Georgia, serif;
  font-style: italic;
  font-size: 15px;
  z-index: 2;
  background: var(--bg);
  transition: opacity 0.4s ease;
}
.loader.is-hidden {
  opacity: 0;
  pointer-events: none;
  visibility: hidden;
}
.loader-mark {
  width: 28px;
  height: 28px;
  border: 1px solid var(--line);
  border-top-color: var(--ink);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.bar {
  flex: 0 0 auto;
  min-height: var(--bar-h);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 16px 14px;
  position: relative;
  z-index: 3;
}

.controls {
  display: flex;
  align-items: center;
  gap: 4px;
}

.btn {
  appearance: none;
  -webkit-appearance: none;
  border: 0;
  background: transparent;
  color: var(--ink);
  width: 44px;
  height: 44px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
}
.btn svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.4;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.btn:hover { background: rgba(0,0,0,0.05); }
.btn:active { background: rgba(0,0,0,0.09); }
.btn:disabled { opacity: 0.28; cursor: default; }
.btn:focus-visible { outline: 1px solid var(--ink); outline-offset: 2px; }

.counter {
  min-width: 88px;
  text-align: center;
  font-variant-numeric: tabular-nums;
  font-size: 12px;
  letter-spacing: 0.12em;
  color: var(--muted);
  padding: 0 8px;
  user-select: none;
}

.bar-right {
  position: absolute;
  right: 16px;
  display: flex;
  align-items: center;
}

@media (max-width: 720px) {
  .header {
    padding: 12px 16px 8px;
    align-items: center;
  }
  .brand h1 { font-size: 13px; letter-spacing: 0.1em; }
  .brand .sub { font-size: 11px; }
  .stage { padding: 8px 10px; }
  .bar { padding: 4px 8px 10px; }
  .bar-right { right: 8px; }
  .counter { min-width: 72px; font-size: 11px; }
}

@media (max-width: 420px) {
  .brand .sub { display: none; }
}
