/* EnjoyaHome Tenerife Journal – digital reader
   Self-contained styles. Scoped to this page only (it runs in its own iframe/page). */

:root {
  --bg: #e9e6e1;          /* neutral warm grey backdrop */
  --bg-deep: #dedad3;
  --ink: #0e1a2f;         /* EnjoyaHome navy */
  --ink-soft: rgba(14, 26, 47, .62);
  --ink-faint: rgba(14, 26, 47, .14);
  --paper: #ffffff;
  --bar-h: 56px;
  --top-h: 44px;
  --radius: 999px;
  --focus: #8a6f3e;
  --serif: "Didot", "Bodoni 72", "Bodoni MT", "Baskerville", "Libre Baskerville", Georgia, serif;
  --sans: "Helvetica Neue", Helvetica, Arial, system-ui, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  background: radial-gradient(ellipse at 50% 40%, #f1eee9 0%, var(--bg) 55%, var(--bg-deep) 100%);
  background-color: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
button { font: inherit; color: inherit; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

#app {
  position: fixed; inset: 0;
  display: flex; flex-direction: column;
  height: 100vh; height: 100dvh;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}

/* ---------- top bar ---------- */
.topbar {
  flex: 0 0 var(--top-h);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 18px;
}
.brand { font-size: 11px; letter-spacing: .22em; text-transform: uppercase; color: var(--ink-soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand-name { color: var(--ink); }
.brand-sep { margin: 0 .7em; }
.top-link {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 11px; letter-spacing: .16em; text-transform: uppercase;
  color: var(--ink); text-decoration: none;
  padding: 7px 12px; border-radius: var(--radius);
  transition: background .2s;
}
.top-link:hover { background: rgba(255,255,255,.55); }
.top-link svg { width: 15px; height: 15px; }

/* ---------- stage & book ---------- */
.stage {
  position: relative; flex: 1 1 auto; min-height: 0;
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
  touch-action: pan-y;
}
.shift {
  transition: transform .55s cubic-bezier(.4, .1, .2, 1);
  will-change: transform;
}
.book { margin: 0 auto; }
.is-loading .book { visibility: hidden; }

.page {
  background: var(--paper);
  overflow: hidden;
}
.page .page-inner { position: absolute; inset: 0; background: var(--paper); }
.page img {
  position: absolute; inset: 0; width: 100%; height: 100%;
  display: block; object-fit: fill;
  user-select: none; -webkit-user-drag: none; pointer-events: none;
  opacity: 0; transition: opacity .25s;
}
.page img.is-ready { opacity: 1; }
.page.is-blank .page-inner { background: #fbfaf8; }

/* soft gutter shading – subtle, like a real binding */
.page .gutter { position: absolute; top: 0; bottom: 0; width: 7%; pointer-events: none; z-index: 2; }
.page.--left .gutter { right: 0; background: linear-gradient(to left, rgba(0,0,0,.10), rgba(0,0,0,.025) 45%, rgba(0,0,0,0)); }
.page.--right .gutter { left: 0; background: linear-gradient(to right, rgba(0,0,0,.10), rgba(0,0,0,.025) 45%, rgba(0,0,0,0)); }
.single-mode .page .gutter { display: none; }

/* soft shadow under the open pages (a separate layer, so the page-turn stays fast) */
.shift { position: relative; }
.bed {
  position: absolute; top: 0; left: 0; pointer-events: none;
  box-shadow: 0 22px 40px -8px rgba(14,26,47,.22), 0 4px 10px rgba(14,26,47,.08);
  transition: left .55s cubic-bezier(.4,.1,.2,1), width .55s cubic-bezier(.4,.1,.2,1);
}
.is-loading .bed { opacity: 0; }

/* clickable links on pages */
.hotspot {
  position: absolute; z-index: 3; display: block;
  border-radius: 3px;
  transition: background .2s, box-shadow .2s;
}
.hotspot:hover, .hotspot:focus-visible { background: rgba(138,111,62,.14); box-shadow: 0 0 0 1px rgba(138,111,62,.35); outline: none; }

/* side arrows (desktop) */
.side-nav {
  position: absolute; top: 50%; transform: translateY(-50%);
  width: 44px; height: 44px; border-radius: 50%;
  border: 0; background: rgba(255,255,255,.55); color: var(--ink);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; opacity: .75; transition: opacity .2s, background .2s;
  z-index: 20;
}
.side-nav:hover { opacity: 1; background: rgba(255,255,255,.85); }
.side-nav.prev { left: 16px; } .side-nav.next { right: 16px; }
.side-nav svg { width: 20px; height: 20px; }
.side-nav[disabled] { opacity: 0; pointer-events: none; }

/* loader */
.loader {
  position: absolute; inset: 0; display: flex; flex-direction: column; gap: 14px;
  align-items: center; justify-content: center; pointer-events: none;
  font-size: 11px; letter-spacing: .2em; text-transform: uppercase; color: var(--ink-soft);
  transition: opacity .4s;
}
#app:not(.is-loading) .loader { opacity: 0; }
.spinner { width: 26px; height: 26px; border: 1.5px solid var(--ink-faint); border-top-color: var(--ink); border-radius: 50%; animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- toolbar ---------- */
.toolbar {
  flex: 0 0 var(--bar-h);
  display: flex; align-items: center; justify-content: center; gap: 2px;
  padding: 0 8px 8px;
}
.tb {
  width: 40px; height: 40px; border: 0; background: transparent; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--ink); cursor: pointer; text-decoration: none;
  transition: background .2s, opacity .2s;
}
.tb:hover { background: rgba(255,255,255,.6); }
.tb[disabled] { opacity: .28; cursor: default; background: transparent; }
.tb svg, .side-nav svg, .top-link svg { fill: none; stroke: currentColor; stroke-width: 1.4; stroke-linecap: round; stroke-linejoin: round; }
.tb svg { width: 20px; height: 20px; }
.tb-sep { width: 1px; height: 20px; background: var(--ink-faint); margin: 0 8px; }
.counter {
  min-width: 108px; height: 36px; padding: 0 14px;
  border: 0; border-radius: var(--radius); background: rgba(255,255,255,.6);
  font-size: 12px; letter-spacing: .12em; color: var(--ink);
  cursor: pointer; font-variant-numeric: tabular-nums;
}
.counter:hover { background: rgba(255,255,255,.9); }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

/* ---------- overlays ---------- */
.overlay[hidden] { display: none !important; }
.overlay { position: fixed; inset: 0; z-index: 100; }

.grid-overlay { background: rgba(233,230,225,.97); display: flex; flex-direction: column; }
.overlay-head {
  flex: 0 0 auto; display: flex; align-items: center; justify-content: space-between;
  padding: 10px 14px 6px 22px;
  font-size: 11px; letter-spacing: .22em; text-transform: uppercase; color: var(--ink-soft);
}
.grid {
  flex: 1 1 auto; overflow-y: auto; -webkit-overflow-scrolling: touch;
  display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 22px 14px;
  padding: 12px 22px 32px; align-content: start;
}
.grid button {
  border: 0; padding: 0; background: none; cursor: pointer; text-align: center;
  display: flex; flex-direction: column; align-items: center; gap: 7px;
}
.grid .thumb { width: 100%; aspect-ratio: 148 / 210; background: #fff; box-shadow: 0 2px 8px rgba(14,26,47,.12); display: block; object-fit: cover; transition: transform .2s, box-shadow .2s; }
.grid button:hover .thumb { transform: translateY(-2px); box-shadow: 0 6px 16px rgba(14,26,47,.18); }
.grid button.is-current .thumb { outline: 2px solid var(--ink); outline-offset: 3px; }
.grid .lbl { font-size: 10px; letter-spacing: .14em; text-transform: uppercase; color: var(--ink-soft); }

.zoom-overlay { background: #d9d5ce; }
.zoom-viewport { position: absolute; inset: 0; overflow: hidden; touch-action: none; cursor: grab; }
.zoom-viewport.is-dragging { cursor: grabbing; }
.zoom-canvas { position: absolute; left: 0; top: 0; transform-origin: 0 0; display: flex; box-shadow: 0 10px 40px rgba(14,26,47,.25); background: #fff; }
.zoom-canvas img { display: block; user-select: none; -webkit-user-drag: none; }
.zoom-bar {
  position: absolute; left: 50%; bottom: max(14px, env(safe-area-inset-bottom)); transform: translateX(-50%);
  display: flex; align-items: center; gap: 2px; padding: 4px 8px;
  background: rgba(255,255,255,.85); border-radius: var(--radius);
  box-shadow: 0 4px 18px rgba(14,26,47,.14);
}
.zoom-level { min-width: 52px; text-align: center; font-size: 12px; letter-spacing: .08em; font-variant-numeric: tabular-nums; }

.noscript { position: fixed; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; background: var(--bg); font-size: 15px; }
.noscript a { color: var(--ink); }

/* ---------- small screens ---------- */
@media (max-width: 700px) {
  :root { --top-h: 40px; --bar-h: 54px; }
  .brand-sep, .brand-title { display: none; }
  .top-link span { display: none; }
  .side-nav { display: none; }
  #btnFirst, #btnLast, #btnGrid { display: none; }
  .tb-sep { margin: 0 4px; }
  .counter { min-width: 92px; padding: 0 10px; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 18px 12px; padding: 10px 14px 28px; }
}
@media (hover: none) { .side-nav { display: none; } }
@media (prefers-reduced-motion: reduce) {
  .shift, .page img, .loader, .tb, .grid .thumb { transition: none !important; }
  .spinner { animation-duration: 3s; }
}

/* sound toggle */
#btnSound .snd-off { display: none; }
#btnSound.is-muted .snd-on { display: none; }
#btnSound.is-muted .snd-off { display: inline; }
#btnSound.is-muted { opacity: .55; }

/* whole-photo links: a gentle brightening on hover */
.hotspot.is-photo:hover { background: rgba(255,255,255,.08); box-shadow: none; }
.hotspot.is-photo:focus-visible { background: rgba(255,255,255,.08); box-shadow: inset 0 0 0 2px rgba(138,111,62,.6); }

/* ---------- access form ---------- */
body.gate-open #app > .topbar, body.gate-open #app > .stage, body.gate-open #app > .toolbar { visibility: hidden; }
.gate[hidden] { display: none !important; }
.gate {
  position: fixed; inset: 0; z-index: 200; overflow-y: auto; -webkit-overflow-scrolling: touch;
  display: flex; align-items: center; justify-content: center;
  padding: max(24px, env(safe-area-inset-top)) 20px max(24px, env(safe-area-inset-bottom));
  background: radial-gradient(ellipse at 50% 40%, #f1eee9 0%, var(--bg) 55%, var(--bg-deep) 100%);
}
.gate-card { display: flex; align-items: center; gap: clamp(28px, 5vw, 72px); max-width: 980px; width: 100%; margin: auto; }
.gate-cover { flex: 0 0 auto; width: min(36vw, 340px); }
.gate-cover img { display: block; width: 100%; height: auto; aspect-ratio: 148 / 210; box-shadow: 0 24px 50px -12px rgba(14,26,47,.35), 0 4px 12px rgba(14,26,47,.12); background: #fff; }
.gate-body { flex: 1 1 auto; max-width: 440px; color: var(--ink); }
.gate-eyebrow { margin: 0 0 14px; font-size: 11px; letter-spacing: .22em; text-transform: uppercase; color: var(--ink-soft); }
.gate-title { margin: 0; font-family: var(--serif); font-weight: 400; font-size: clamp(34px, 4.6vw, 52px); line-height: 1.05; letter-spacing: .01em; }
.gate-sub { margin: 8px 0 0; font-family: var(--serif); font-style: italic; font-size: 18px; color: var(--ink-soft); }
.gate-text { margin: 22px 0 22px; font-size: 14px; line-height: 1.6; color: var(--ink-soft); }
.gate-form { display: flex; flex-direction: column; gap: 14px; }
.gate-field { display: flex; flex-direction: column; gap: 6px; font-size: 10.5px; letter-spacing: .18em; text-transform: uppercase; color: var(--ink-soft); }
.gate-field input {
  font: 15px var(--sans); color: var(--ink); letter-spacing: normal; text-transform: none;
  padding: 12px 14px; border: 1px solid rgba(14,26,47,.22); border-radius: 2px; background: rgba(255,255,255,.75);
  transition: border-color .2s, background .2s;
}
.gate-field input:focus { outline: none; border-color: var(--ink); background: #fff; }
.gate-check { display: flex; gap: 10px; align-items: flex-start; font-size: 12px; line-height: 1.5; color: var(--ink-soft); }
.gate-check input { margin: 2px 0 0; width: 16px; height: 16px; accent-color: var(--ink); flex: 0 0 auto; }
.gate-check a { color: var(--ink); }
.gate-info { font-size: 11.5px; line-height: 1.5; color: var(--ink-soft); background: rgba(255,255,255,.55); padding: 12px 14px; border-left: 2px solid var(--ink-faint); }
.gate-info p { margin: 0 0 6px; } .gate-info p:last-child { margin: 0; }
.gate-error { margin: 0; font-size: 13px; color: #9b2c22; }
.gate-btn {
  margin-top: 6px; padding: 15px 22px; border: 0; border-radius: 2px; cursor: pointer;
  background: var(--ink); color: #fff; font: 12px var(--sans); letter-spacing: .2em; text-transform: uppercase;
  transition: background .2s, opacity .2s;
}
.gate-btn:hover { background: #1c2c48; } .gate-btn[disabled] { opacity: .6; cursor: default; }
.gate-hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
@media (max-width: 760px) {
  .gate { align-items: flex-start; }
  .gate-card { flex-direction: column; gap: 22px; text-align: left; }
  .gate-cover { width: min(46vw, 190px); margin: 4px auto 0; }
  .gate-text { margin: 14px 0 16px; }
}
