/* Once Upon an App — static recreation of onceuponanapp.com
   Layout and type follow the live Responsive Pro (CyberChimps) site. */

:root {
  --text: #303030;
  --heading: #424242;
  --muted: #9f9f9f;
  --bg: #dddddb;
  --panel: #ffffff;
  --rule: #e5e5e5;
  --link: #9c3030;
  --link-hover: #d6221b;
  --menu-top: #585858;
  --menu-bottom: #3d3d3d;
  --menu-current: #343434;
  --max: 960px;
  --pad: 1rem;
}

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

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: Arial, Helvetica, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg) url("/images/tile.jpg") left top repeat fixed;
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; height: auto; }

a { color: var(--link); text-decoration: none; }
a:hover,
a:focus { color: var(--link-hover); text-decoration: underline; }

h1, h2, h3, h4 {
  color: var(--heading);
  font-weight: 700;
  line-height: 1.1;
  margin: 0.75em 0 0.5em;
  overflow-wrap: anywhere;
}
h1 { font-size: 2.25em; margin-top: 0; }
h2 { font-size: 1.75em; }
h3 { font-size: 1.25em; }

p, ul, ol { margin: 0 0 1em; }
hr { border: 0; border-top: 1px solid #ddd; margin: 1.5em 0; }

.visually-hidden,
.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  width: 1px;
  height: 1px;
  overflow: hidden;
}
.skip-link:focus {
  left: var(--pad);
  top: 0.5rem;
  width: auto;
  height: auto;
  background: #000;
  color: #fff;
  padding: 0.5rem 0.75rem;
  z-index: 100;
}

#container {
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 var(--pad);
}

/* Header: full-width logo image, then the dark menu bar */
#header { margin: 0; padding-top: 10px; }
#logo { margin: 0; }
#logo img { display: block; width: 100%; height: auto; }

.main-nav { position: relative; }
.nav-toggle { display: none; }
.menu {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  background: linear-gradient(to bottom, var(--menu-top), var(--menu-bottom));
}
.menu li { margin: 0; }
.menu a {
  display: block;
  padding: 0 0.9em;
  height: 45px;
  line-height: 45px;
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  text-shadow: 0 -1px 0 #000;
  border-left: 1px solid var(--menu-top);
  white-space: nowrap;
}
.menu li:first-child a { border-left: 0; }
.menu a:hover,
.menu a:focus { color: #fff; text-decoration: none; background: var(--menu-current); }
.menu a[aria-current="page"] { background: var(--menu-current); }

/* White content panel */
#wrapper {
  background: var(--panel);
  border: 1px solid var(--rule);
  border-radius: 4px;
  margin: 20px auto;
  padding: 20px;
  display: flex;
  flex-wrap: wrap;
  gap: 0 2.1277%;
  align-items: flex-start;
}
#content { width: 100%; margin-top: 20px; min-width: 0; }
#content.with-sidebar { width: 65.957%; }
#widgets { width: 31.915%; margin-top: 20px; }

.widget-wrapper {
  background: #f9f9f9;
  border: 1px solid var(--rule);
  border-radius: 4px;
  padding: 20px;
  margin: 0 0 20px;
}
.widget-wrapper p:last-child { margin-bottom: 0; }
.widget-title { font-size: 1.3em; margin: 0 0 0.75em; }

.post-title a { color: var(--heading); }
.post-title a:hover { color: var(--link-hover); text-decoration: none; }
.post .post-title { margin-top: 0; }
.post-entry { clear: both; }
.post-entry img { max-width: 100%; height: auto; }
.lede { font-size: 1.1em; }
.unavailable { color: var(--muted); font-style: italic; }

/* App Store listing */
.app { overflow: hidden; }
.app-icon { float: left; margin: 0.3em 20px 10px 0; }
.app-icon img {
  width: 128px;
  height: 128px;
  border-radius: 24px;
  display: block;
  background: #eee;
}
.app-body { overflow: hidden; }
.app-body h3:first-child { margin-top: 0; }
.app-buy { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5em 1em; }
.app-buy img { display: block; }
.price { font-weight: 700; }
.app-rating { display: flex; align-items: center; gap: 0.5em; margin: 0.5em 0 1em; }
.rating-bar {
  display: inline-block;
  width: 155px;
  height: 31px;
  background: url("/images/icons/star-empty.png") 0 0 repeat-x;
  vertical-align: middle;
}
.rating-bar span {
  display: block;
  height: 31px;
  background: url("/images/icons/star-full.png") 0 0 repeat-x;
}
.rating-text { color: var(--muted); }
.button {
  display: inline-block;
  padding: 6px 14px;
  background: linear-gradient(to bottom, #79bbff 0%, #378de5 100%);
  color: #fff;
  border-radius: 4px;
  font-size: 13px;
  box-shadow: 0 1px 2px rgba(0,0,0,0.3);
}
.button:hover,
.button:focus { color: #fff; text-decoration: none; background: #378de5; }
.app-more { clear: both; text-align: center; margin: 1em 0 0; }
.screenshots {
  list-style: none;
  margin: 0 0 1.5em;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  clear: both;
}
.screenshots li { margin: 0; }
.screenshots img {
  display: block;
  height: 160px;
  width: auto;
  max-width: 100%;
  border: 1px solid var(--rule);
  border-radius: 4px;
  background: #f4f4f4;
}

/* Video embed */
.video { position: relative; aspect-ratio: 16 / 9; max-width: 100%; margin: 0 0 1em; }
.video iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }

/* About Us slideshow */
.slideshow {
  position: relative;
  aspect-ratio: 900 / 399;
  background: #000;
  margin: 1.5em 0 0;
  overflow: hidden;
  border-radius: 4px;
}
.slideshow .slide {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity 0.8s ease;
}
.slideshow .slide.is-active { opacity: 1; }
.slide-prev,
.slide-next {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(0,0,0,0.45);
  color: #fff;
  border: 0;
  width: 40px;
  height: 56px;
  font-size: 2em;
  line-height: 1;
  cursor: pointer;
  border-radius: 4px;
}
.slide-prev { left: 8px; }
.slide-next { right: 8px; }
.slide-prev:hover,
.slide-next:hover { background: rgba(0,0,0,0.7); }

/* Holiday page */
.promo { float: left; margin: 0 20px 20px 0; max-width: 300px; }
.page .post-entry::after { content: ""; display: block; clear: both; }

/* Post navigation */
.post-nav {
  display: flex;
  justify-content: space-between;
  gap: 1em;
  font-size: 13px;
  margin: 20px 0;
  clear: both;
}
.post-nav p { margin: 0; }
.post-nav .next { text-align: right; }

/* Footer */
#footer { font-size: 11px; line-height: 1.5; padding: 0 0 20px; color: #333; }
#footer a { color: #333; }
#footer a:hover { color: var(--link-hover); }
.footer-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 0.5em 1em;
  margin-bottom: 1em;
}
.footer-menu,
.social-icons { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; align-items: center; }
.footer-menu li a { border-left: 1px solid #ccc; padding: 0 8px; }
.footer-menu li:first-child a { border-left: 0; padding-left: 0; }
.social-icons li { margin-left: 6px; }
.social-icons img { display: block; }
.footer-meta p { margin: 0; }
.footer-meta .scroll-top a { font-size: 16px; padding: 0 1em; }

@media (max-width: 760px) {
  #content.with-sidebar,
  #widgets { width: 100%; }
  #widgets { margin-top: 0; }
  h1 { font-size: 1.8em; }
  h2 { font-size: 1.4em; }
}

@media (max-width: 650px) {
  .nav-toggle {
    display: block;
    width: 100%;
    border: 0;
    background: linear-gradient(to bottom, var(--menu-top), var(--menu-bottom));
    color: #fff;
    font: 700 13px/45px Arial, Helvetica, sans-serif;
    text-align: left;
    padding: 0 0.9em;
    cursor: pointer;
  }
  .nav-toggle::after { content: " \25BE"; }
  .nav-toggle[aria-expanded="true"]::after { content: " \25B4"; }
  .menu { display: none; flex-direction: column; background: var(--menu-bottom); }
  .nav-toggle[aria-expanded="true"] + .menu { display: flex; }
  .menu a { border-left: 0; border-top: 1px solid var(--menu-top); white-space: normal; height: auto; line-height: 1.4; padding: 10px 0.9em; }
  #wrapper { padding: 12px; }
  .app-icon { float: none; margin: 0 0 10px; }
  .promo { float: none; margin: 0 0 1em; max-width: 100%; }
  .footer-row { flex-direction: column; align-items: flex-start; }
  .footer-meta { align-items: flex-start; }
}

/* Version tag */
.site-version { font-size: 9px; color: #777; letter-spacing: 0.02em; }

/* Classic Storybooks (consolidated app) */
.classics-hero {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 4px;
  margin: 0.5em 0 1.25em;
}
.classics-note { color: var(--muted); font-style: italic; }
.bullets { padding-left: 1.3em; }
.bullets li { margin-bottom: 0.4em; }
.credits { color: var(--muted); font-size: 13px; margin-top: 1.5em; }

/* Read-Along iBooks */
.books {
  list-style: none;
  padding: 0;
  margin: 1em 0 1.5em;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 1.5em 1.25em;
}
.books li { display: flex; flex-direction: column; gap: 0.35em; }
.books img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 3 / 4;
  object-fit: cover;
  object-position: top;
  border-radius: 4px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.25);
  margin-bottom: 0.4em;
}
.book-title { display: block; font-weight: 700; line-height: 1.3; }
.book-blurb { color: #666; font-size: 13px; line-height: 1.4; }
