/*
  site.css — shared fixes loaded AFTER newstyle.css on every notes page.
  It doesn't change your colours or fonts; it makes pages work on phones
  and holds styles that used to be copied into each page.
*/

/* Key words in notes (was repeated as b { color:red } on every page) */
b { color: red; }

/* ---------- Phones and small screens ---------- */

/* Pictures never spill off the side of the screen */
img { max-width: 100%; }
img:not([height]) { height: auto; }

/* YouTube videos shrink to fit the screen and keep their shape */
iframe[src*="youtube"] {
  display: block;
  width: 100%;
  max-width: 760px;
  height: auto;
  aspect-ratio: 16 / 9;
  margin-left: auto;
  margin-right: auto;
}

/* Microsoft Forms quizzes and other embeds fit the screen width */
iframe { max-width: 100%; }

/* Wide tables scroll sideways inside their box instead of breaking the page */
.container { overflow-x: auto; }

/* Pictures floated beside text stack underneath it on phones */
@media (max-width: 600px) {
  img[style*="float"] {
    float: none !important;
    display: block;
    margin: 10px auto;
    padding: 0 !important;
  }
}

/* Clears floated pictures at the end of a section */
.clear { clear: both; }

/* ---------- Menu ---------- */

/* Menu tiles (the menu itself is built by site.js) */
#site-nav a { text-decoration: none; }
/* The section you're in is shown in pink, like the hover colour */
#site-nav a.current .navtile { background-color: hsl(355, 75%, 71%); }

/* ---------- Phone layout ---------- */
@media (max-width: 856px) {
  /* Menu as a compact 2-column grid instead of 7 tall blocks */
  #site-nav {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    padding: 8px;
  }
  #site-nav .navtile {
    display: block;
    width: 100%;
    height: auto;
    margin: 0;
    padding: 10px 4px;
    font-size: 1.2rem;
  }
}

@media (max-width: 600px) {
  body { margin: 3%; }

  /* Header: let it grow instead of the name spilling out of the box */
  header { height: auto; padding: 8px 4px; align-items: center; }
  header h1 { font-size: 1.7rem; padding-left: 0; margin: 0.3em 0; }
  #profile img { width: 60px; height: auto; }

  /* Comfortable reading size on a phone */
  .container { padding: 1rem; }
  p, li, h3, th, td { font-size: 1.1rem; }
  h2 { font-size: 1.5rem; }

  /* Diagrams use the full width on a phone */
  .centre, .centre30, .centre20 { width: 100%; }
}

/* ---------- Ready for selling ---------- */

/* A "next step" box for the end of a notes page, e.g.
   <div class="buy-box">
     <h2>Ready to practise?</h2>
     <p>Get the ... Revision Pack with full worked answers.</p>
     <a class="buy-button" href="LINK-FROM-PAYHIP-OR-STRIPE">Get the pack – £5</a>
   </div>
*/
.buy-box {
  max-width: 760px;
  margin: 24px auto;
  padding: 20px 24px;
  border: 2px solid hsl(196, 87%, 45%);
  border-radius: 10px;
  background: hsl(196, 87%, 96%);
  text-align: center;
}
.buy-box h2 { margin-top: 0; }
.buy-button {
  display: inline-block;
  margin-top: 8px;
  padding: 12px 22px;
  border-radius: 8px;
  background: hsl(196, 87%, 40%);
  color: #fff;
  font-weight: bold;
  text-decoration: none;
}
.buy-button:hover { background: hsl(196, 87%, 32%); }
