
:root{
  --paper: #f5efde;
  --paper2:#efe4cf;
  --ink: #3d332a;
  --ink2:#5b4c3c;
  --shadow: rgba(0,0,0,.18);
  --shadow2: rgba(0,0,0,.10);
  --accent: #7a5b3a;
  --accent2:#a07b50;
  --edge: rgba(61,51,42,.22);
  --soft: rgba(61,51,42,.12);
  --radius: 22px;
}

*{ box-sizing:border-box; }
html,body{ height:100%; }
body{
  margin:0;
  color:var(--ink);
  font-family: ui-serif, Georgia, "Times New Roman", Times, serif;
  background:
    radial-gradient(1200px 800px at 20% 0%, rgba(255,255,255,.6), transparent 55%),
    radial-gradient(900px 600px at 80% 20%, rgba(255,255,255,.45), transparent 60%),
    linear-gradient(180deg, var(--paper) 0%, var(--paper2) 100%);
}

#app{
  min-height:100%;
  display:flex;
  flex-direction:column;
}

.masthead{
  display:flex;
  align-items:flex-end;
  justify-content:space-between;
  padding: 18px clamp(14px, 3vw, 28px) 10px;
  gap:16px;
}

.masthead__titlewrap{ max-width: 58rem; }
#title{
  font-family: "Prata", Georgia, serif;
  margin:0;
  font-size: clamp(1.25rem, 2.6vw, 2.1rem);
  letter-spacing: .2px;
}
#subtitle{
  margin:6px 0 0 0;
  font-size: clamp(.95rem, 1.4vw, 1.05rem);
  color: rgba(61,51,42,.82);
}

.iconbtn{
  border: 1px solid var(--edge);
  background: rgba(255,255,255,.35);
  color: var(--ink);
  padding: 10px 12px;
  border-radius: 999px;
  cursor:pointer;
  box-shadow: 0 6px 18px var(--shadow2);
  backdrop-filter: blur(6px);
}
.iconbtn:hover{ background: rgba(255,255,255,.5); }

.layout{
  flex:1;
  display:grid;
  grid-template-columns: 1fr;
  gap: 16px;
  padding: 6px clamp(14px, 3vw, 28px) 18px;
}

.page{ min-width:0; }
.globe{ min-width:0; transition: opacity .18s ease, max-height .18s ease; max-height: 900px; }

.page__frame{
  border-radius: var(--radius);
  border: 1px solid var(--edge);
  background:
    linear-gradient(180deg, rgba(255,255,255,.35), rgba(255,255,255,.15)),
    repeating-linear-gradient(90deg, rgba(61,51,42,.035), rgba(61,51,42,.035) 2px, transparent 2px, transparent 12px);
  box-shadow: 0 18px 44px var(--shadow);
  overflow:hidden;
}

.page__imagewrap{
  position:relative;
  padding: 14px;
}
.page__imagewrap::before{
  content:"";
  position:absolute;
  appearance:none;
  border:none;
  inset: 0;
  pointer-events:none;
  background:
    radial-gradient(800px 240px at 50% 0%, rgba(0,0,0,.10), transparent 70%),
    radial-gradient(900px 380px at 50% 110%, rgba(0,0,0,.10), transparent 70%);
  opacity:.35;
}

#storyImg{
  display:block;
  width:100%;
  height:auto;
  border-radius: calc(var(--radius) - 8px);
  border: 1px solid rgba(61,51,42,.18);
  background: rgba(255,255,255,.35);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.25);
}

.imgloading{
  position:absolute;
  appearance:none;
  border:none;
  top: 22px;
  left: 22px;
  padding: 8px 10px;
  border-radius: 999px;
  background: rgba(245,239,222,.92);
  border: 1px solid rgba(61,51,42,.20);
  color: rgba(61,51,42,.80);
  font-size: .92rem;
  box-shadow: 0 10px 28px var(--shadow2);
  display:none;
}

.page__caption{
  padding: 12px 18px 18px;
  border-top: 1px solid rgba(61,51,42,.14);
  background: rgba(245,239,222,.55);
}

.page__meta{
  display:flex;
  align-items:center;
  gap:10px;
  margin-bottom: 8px;
}

.tag{
  display:inline-block;
  font-size:.86rem;
  padding: 5px 10px;
  border-radius:999px;
  border: 1px solid rgba(61,51,42,.18);
  background: rgba(255,255,255,.30);
}

.place{
  font-size:.95rem;
  color: rgba(61,51,42,.82);
}

.caption{
  font-family: "Prata", Georgia, serif;
  margin:0;
  font-size: clamp(1.02rem, 1.5vw, 1.18rem);
  line-height: 1.45;
  letter-spacing: .1px;
}

.controls{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap: 12px;
  padding: 12px 4px 0;
}

.navbtn{
  border: 1px solid rgba(61,51,42,.22);
  background: rgba(255,255,255,.45);
  padding: 12px 14px;
  border-radius: 999px;
  cursor:pointer;
  color: var(--ink);
  box-shadow: 0 10px 26px var(--shadow2);
}
.navbtn:hover{ background: rgba(255,255,255,.65); }
.navbtn:disabled{
  opacity:.45;
  cursor:not-allowed;
}

.progress{ flex:1; display:flex; justify-content:center; }
.dots{
  display:flex;
  gap:8px;
  align-items:center;
  justify-content:center;
  flex-wrap:wrap;
  padding: 0 6px;
  max-width: 520px;
}
.dot{
  width: 10px;
  height: 10px;
  border-radius: 999px;
  border: 1px solid rgba(61,51,42,.28);
  background: rgba(255,255,255,.35);
  box-shadow: 0 5px 10px rgba(0,0,0,.08);
}
.dot--active{
  transform: scale(1.25);
  background: rgba(160,123,80,.62);
  border-color: rgba(61,51,42,.35);
}

.globe__frame{
  position:relative;
  border-radius: var(--radius);
  border: 1px solid var(--edge);
  background:
    radial-gradient(600px 340px at 30% 10%, rgba(255,255,255,.55), transparent 60%),
    linear-gradient(180deg, rgba(255,255,255,.20), rgba(255,255,255,.06));
  box-shadow: 0 18px 44px var(--shadow);
  overflow:hidden;
  min-height: 240px;
}

.globe__canvas{
  width: 100%;
  height: 100%;
  min-height: 240px;
}

.globe__label{
  cursor: pointer;

  position:absolute;
  appearance:none;
  border:none;
  right: 14px;
  bottom: 12px;
  font-size:.86rem;
  padding: 6px 10px;
  border-radius:999px;
  background: rgba(245,239,222,.85);
  border: 1px solid rgba(61,51,42,.18);
  color: rgba(61,51,42,.82);
}

.globeloading{
  position:absolute;
  appearance:none;
  border:none;
  left: 14px;
  top: 12px;
  font-size:.92rem;
  padding: 8px 10px;
  border-radius:999px;
  background: rgba(245,239,222,.92);
  border: 1px solid rgba(61,51,42,.20);
  color: rgba(61,51,42,.80);
  box-shadow: 0 10px 28px var(--shadow2);
  z-index: 5;
}

.footer{
  padding: 10px clamp(14px, 3vw, 28px) 14px;
  color: rgba(61,51,42,.72);
  font-size:.9rem;
}

/* Modal */
.modal[hidden]{ display:none; }
.modal{
  position:fixed;
  inset:0;
  display:grid;
  place-items:center;
  z-index: 9999;
}
.modal__backdrop{
  position:absolute;
  appearance:none;
  border:none;
  inset:0;
  background: rgba(20,16,12,.35);
}
.modal__panel{
  position:relative;
  width: min(720px, calc(100% - 28px));
  background: rgba(245,239,222,.98);
  border: 1px solid rgba(61,51,42,.25);
  border-radius: var(--radius);
  box-shadow: 0 28px 70px rgba(0,0,0,.35);
  padding: 16px 16px 14px;
}
.modal__panel h2{
  margin: 4px 0 10px;
}
.modal__content{
  color: rgba(61,51,42,.86);
  line-height: 1.45;
  font-size: 1rem;
}
.modal__content code{
  background: rgba(255,255,255,.55);
  padding: 2px 6px;
  border-radius: 8px;
  border: 1px solid rgba(61,51,42,.12);
}
.modal__actions{
  display:flex;
  justify-content:flex-end;
  padding-top: 8px;
}
.small{ font-size:.92rem; color: rgba(61,51,42,.75); }

/* Desktop layout: keep image dominant, globe as a quiet companion */
@media (min-width: 920px){
  .layout{
    grid-template-columns: 1.55fr .85fr;
    align-items:start;
  }
  .globe__frame{ min-height: 520px; }
  .globe__canvas{ min-height: 520px; }
}


body.globe--expanded .globe__frame{
  height: calc(100vh - 20px);
  min-height: calc(100vh - 20px);
}
body.globe--expanded .globe__canvas{
  height: calc(100vh - 20px);
  min-height: calc(100vh - 20px);
}
body.globe--expanded .page,
body.globe--expanded .footer,
body.globe--expanded .masthead{
  opacity: 0.65;
  pointer-events:none;
}

body.globe--expanded .globe__label{
  cursor: pointer;

  background: rgba(245,239,222,.96);
  border-color: rgba(61,51,42,.30);
}


