/* ===== Mobile first ===== */

body {
  margin: 0;
  padding: 12px;
  font-family: Arial, Helvetica, sans-serif;
  line-height: 1.5;
  background-color: #f0f0d8;
 }
 
body.image-bg {
  background-image: url("../graphics/bratsbackilc.gif");
  background-repeat: repeat;   /* or no-repeat / cover */
}

* {
  box-sizing: border-box;
  border-radius: 9px;
}

.page-content {
  max-width: 75rem;
  margin-inline: auto;
  padding-inline: 1rem;
}

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

.ce { vertical-align: middle;
}

#co { color: red; }
.cd {text-align: left; 
}

a {
  text-decoration: none;
  color: inherit;
}

a:hover {
  text-decoration: none;
}

.site-header,
main,
.site-footer {
  padding: 0.8rem;
  text-align: center;
  font-size: 0.9rem;
}

/*.centre {
        display: run-in;
        margin-left: auto;
        margin-right: auto;
        text-align: center;
}
*/
.centre {
  max-width: none; /* Remove the max-width constraint */
  margin: 0 auto;  /* Center the content horizontally */
  text-align: center;
}

.centre p {
  margin: 0.5rem 0;
}


/* Navigation */
.navbar {
  background: #003366;
  padding: 0.75rem;
}

.menu-toggle {
  width: 100%;
  max-width: 420px;
  margin: 0 auto;
  padding: 1rem;
  background: #003366;
  color: #fff;
  border: none;
  font-size: 1.1rem;
  display: block;
}

.nav-list {
  list-style: none;
  padding: 0.25rem 0;
  margin: 0;
  display: none;
}

.nav-list.open {
  display: block;
}

.nav-list li a {
  display: block;
  padding: 0.75rem 1.25rem;
  color: #fff;
  text-decoration: none;
  text-align: center;
  border-top: 1px solid #335588;
}

/* Buttons / links */
.button {
  display: block;
  margin: 0.5rem auto;
  padding: 0.75rem;
  background: #0059b3;
  color: #fff;
  text-decoration: none;
  max-width: none; /* Remove max-width to let buttons grow on larger screens */
}

.button:hover {
background-color : #555555;
}

.button img {
    width: 60px;
    height: 20px;
    border: 0;
    display: inline-block;
    vertical-align: middle;
}

/* ===== Tablet & up ===== */
@media (min-width: 768px) {

  .menu-toggle {
    display: none;
  }

  .nav-list {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
  }

  .nav-list li a {
    border: none;
	text-align: left;
  }

  .links {
    display: flex;
    justify-content: center;
	align: center;
    flex-wrap: wrap;
    gap: 0.5rem;
  }

  .button {
    margin: 0.25rem;
  }
  
  .centre {
    max-width: 600px;  /* Set a reasonable max width for larger screens */
  }

  .button {
    max-width: 100%;   /* Ensure buttons can expand to container width */
  }
}

.grid-container {
  display: flex;
  flex-wrap: wrap;  /* Allows the boxes to wrap and resize based on content */
  border:none; 
  gap: 20px;
  padding: 1rem;
  width: 100%;
  justify-content: space-between;
}

.grid-container > div {
  background-color: #f0f0d8;
  text-align: center;
  padding: 10px;
  font-size: 14px;
  flex-grow: 1; /* Ensures that the boxes grow to fit content */
  min-width: 200px;  /* Ensures the boxes don’t shrink too small */
  max-width: 500px;  /* You can adjust this as needed */
  word-wrap: break-word;  /* Allows text to wrap within the box */
  word-break: break-word;  /* Breaks long words that don’t fit */
  overflow-wrap: break-word; /* Wrap long words inside */
  white-space: normal;  /* Ensure text wraps */
  overflow: hidden;
  flex-shrink: 1; /* Ensures boxes can shrink */
}

/* Two Column Layout for Topic and Revision */
.grid-container.two-column-menu {
  grid-template-columns: repeat(2, 1fr);  /* Flexible two columns */
  column-gap: 40px;
}

.menu-column {
  padding: 10px;
  background-color: #f0f8ff;
  border-radius: 4px;
  overflow-wrap: break-word;
  word-wrap: break-word;
  word-break: break-word;
  hyphens: auto;  /* Allow hyphenation */
  text-align: left;
  font-size: 0.9em;
  height: auto;  /* Allow box height to grow based on content */
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  white-space: normal;
  min-width: 200px;
  overflow: hidden;
  flex-shrink: 1;
  }

/* Green header for columns */
.gre.b {
  background-color: green;
  color: white;
  padding: 10px;
  font-size: 1.1em;
  text-align: center;
  margin-bottom: 10px;
}

.grid-container1 {
  display: grid;
  grid-template-columns: auto auto;
  gap: 1px;
  column-rule: 4px double #ff00ff;
  column-count: 2;
  padding: 1rem;
}

.grid-container1 > div {
  background-color: #f0f0d8;
  text-align: center;
  padding: 20px 0;
  font-size: 17px;
  grid-row: 1 / span 2;
}

.grid-container2 { display: grid;
  grid-template-columns: auto auto auto auto auto auto;
  gap: 1px;
  background-color: black;
  padding: 1px; }
  
.grid-container2 > div {
  background-color: #f0f0d8;
  text-align: center;
  padding: 20px 0;
  font-size: 20px;
}

.grid-item {
  border: 1px solid rgba(0, 0, 0, 0.8);
  padding: 20px;
  font-size: 14px;
  text-align: center;
}

.grid-container3 { display: grid;
  grid-template-columns: auto auto auto auto;
  gap: 1px;
  background-color: black;
  padding: 1px; }
  
.grid-container3 > div {
  background-color: #f0f0d8;
  text-align: center;
  padding: 20px 0;
  font-size: 20px;
}  

/* Centre Headers */
h1,h2,h3,h4 { text-align: center;
              margin: 0 0 0.5rem 0; }
ul.nb {
  list-style-type: none;
  margin: 0;
  padding: 0;
}

/* FONTS */
.sans { font-family : Arial, Helvetica, sans-serif;
}

.comi { font-family : 'Comic Sans MS', Tahoma;
}

ul.d { font-family: 'Comic Sans MS', Tahoma; 
}

.s3 { 
font-size: 16px;
}

.s4 {
font-size : 18px;
}

.s5 {
font-size : 20px;
}

.s6 {
font-size : 28px;
}

.jus {
text-align : justify;
}

.sans { font-family : Arial, Helvetica, sans-serif;
}

.comi { font-family : 'Comic Sans MS', Tahoma;
}

.big-word {
  font-size: 1.5em; /* relative to the surrounding text */
}


/* Wrapper enables horizontal scroll */
.table-wrapper {
  width: 100%;
  overflow-x: auto;
  max-width: 100%; /* Prevents wrapper from extending beyond screen width */
}

/* Ensure table keeps its width */
table {
  border: 1px solid black;
  margin-left : auto;
  margin-right : auto;
  width : 85%;
  text-align: center;
  padding: 3px;
  min-width: 750px; /* forces scroll on phones */
}

/* Mobile tweaks */
@media(max-width: 768px) {
  table td,
  table th {
    font-size: 0.9rem;
    padding: 0.5rem;
  }
}

/* Optional: Make the layout responsive (stack on smaller screens) */
@media screen and (max-width: 768px) {
  .grid-container {
    grid-template-columns: 1fr; /* Stack the columns on smaller screens */
  }
}


span.b { 
  display : grid;
  width: 120px;
  height: 75px;
  padding: 3px;
  text-align: center;
  border: 2px solid blue;    
  background-color: lightyellow;
  
  }



/* COLOURS */
.red {
color : red;
}
.blu {
color : blue;
}
.gre {
color : green;
}
.dg { 
color: darkgreen;
}
.yel {
color : yellow;
}
.bla {
color : #0f0f0f;
}
.bro {
color : brown;
}
.go { 
color: gold;
}
.sil { 
color: silver;
}
.vio {color: violet; 
}
.whi {color: white; 
}
.gry {color: grey; 
}
.bg {
background-color: #ffffff }

span.b { 
  display : grid;
  width: 120px;
  height: 75px;
  padding: 3px;
  text-align: center;
  border: 2px solid blue;    
  background-color: lightyellow;
  }
  
table.z {
border: none;
border-collapse : collapse;
width : 85%;
}

td.b {
border: 1px solid black;
width : auto;
text-align: center;
}

table.e {
margin-left : auto;
margin-right : auto;
width : 85%;
}

table.f {
table-layout: auto; /* Forces fixed table layout for more consistent behavior */
margin-left : auto;
margin-right : auto;
border-collapse: separate;
border-radius : 9px;
padding: 3px;
width: 100%;  /* Remove the 85% width or make it responsive */
min-width: 320px; /* keep this for larger screens */
}

/* Mobile-specific table tweaks */
@media(max-width: 768px) {
  table.f {
    min-width: 320px;  /* Set a minimum width on small screens */
    width: 100%; /* Ensure it takes up the full width of the container */
  }

  table.f td,
  table.f th {
    padding: 0.4rem; /* Smaller padding for better mobile fit */
    font-size: 0.85rem;  /* Reduce font size further on small screens */
  }
}
table.f td,
table.f th {
  word-wrap: break-word;
  overflow-wrap: break-word;
  border-radius: 9px;
}

  table.f td,
  table.f th {
    font-size: 0.8rem;  /* Further reduce font size for smaller screens */
    padding: 0.3rem; /* Further reduce padding */
  }

/* Center everything on the page */
.page {
  display: flex;
  justify-content: center; /* horizontal centering only */
  margin-top: 0.5rem;      /* small tidy gap under the h2 */
}

/* Grid container */
.grid {
  display: grid;
  grid-template-columns: 1fr;   /* ONE column on phones */
  gap: 10px;
  width: 100%;
  max-width: 300px;
  margin: 0 auto;               /* true centering */
}

@media (min-width: 480px) {
  .grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* Boxes */
.box {
  padding: 0;
  background: none;
  height: 100%;
}

.box a {
  display: flex;              /* change from block to flex */
  align-items: center;        /* vertical centering */
  justify-content: center;    /* horizontal centering */
  
  padding: 1.5rem;
  text-align: center;
  color: brown;
  border: 1px solid lightblue;
  border-radius: 8px;
  background-color: lightyellow;
  height: 100%;
  min-height: 110px;   /* ? ADD THIS LINE */
  box-shadow: inset 0 0 0 1px blue;  /* Samsung-safe “border” *
  
}

.result-button img {
  pointer-events: none;
}