/* war_diary_mobile.css
   Loaded AFTER war_diary_stylesheet.css, so these rules override it.
   Desktop look is left as it was; only small screens change. */

/* ---------- Previous / Next month links ---------- */
.diary-nav {
  display: flex;
  justify-content: space-between;
  gap: .5rem;
  margin: 1rem 0;
}
.diary-nav a { text-align: center; }

/* ---------- Downloads page: rows of buttons ---------- */
.download-row {
  display: flex;
  flex-wrap: wrap;
  gap: .75rem;
  margin-bottom: 1.5rem;
}

/* ---------- Diary table, desktop ---------- */
@media (min-width: 701px) {
  .diary .c-place, .diary .c-date,
  .diary .c-scribe, .diary .c-appx { text-align: center; }

  .diary .c-place  { width: 10%; }
  .diary .c-date   { width: 10%; }
  .diary .c-entry  { width: 50%; }
  .diary .c-scribe { width: 15%; }
  .diary .c-appx   { width: 15%; }

  /* Individuals page */
  .individuals .c-rank     { width: 10%; }
  .individuals .c-initials { width: 15%; }
  .individuals .c-last     { width: 10%; }
  .individuals .c-awards   { width: 15%; }
  .individuals .c-title    { width: 20%; }
  .individuals .c-notes    { width: 30%; }
}

/* ---------- Phones / small tablets ---------- */
@media (max-width: 700px) {

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

  /* Was 30px each side, which wastes a lot of a phone screen */
  body { margin: 10px; line-height: 1.5; }
  h1 { font-size: 1.4rem; }
  h2 { font-size: 1.1rem; }
  h3 { font-size: 1rem; }

  /* The background image had min-width:1024px, wider than any phone.
     Fixed to the screen and cropped to fit instead. */
  #full-screen-background-image {
    min-width: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
  }

  /* Top menu: wrapping buttons (the 45px line-height would make them huge) */
  .mylinks { display: flex; flex-wrap: wrap; gap: .5rem; line-height: 1.3; }
  .mylinks br { display: none; }
  .LinkButton { font-size: 1rem; padding: .7rem .5rem; }
  .mylinks .LinkButton { flex: 1 1 40%; text-align: center; }
  .HiddenLinkButton { font-size: 1rem; padding: 6px; }

  /* Labels, search box, month dropdown, button */
  label { display: inline-block; font-size: 18px; padding: 2px 8px; margin-bottom: .4rem; }
  .search-form { display: flex; flex-direction: column; gap: .5rem; }
  .search-form label { align-self: flex-start; }
  .inputbox-size, .combo-size {
    width: 100%;
    max-width: 100%;
    font-size: 18px;      /* 16px or more stops iOS zooming in on focus */
  }
  input[type=submit] {
    width: 100%;
    font-size: 20px;
    border-width: 4px;
    min-height: 48px;
  }

  /* Each day becomes a card */
  .diary, .diary tbody, .diary td { display: block; width: 100%; }
  .diary thead { display: none; }

  .diary tr {
    display: flex;
    flex-direction: column;
    width: 100%;
    margin-bottom: 1rem;
    border: 1px solid black;
  }

  .diary td {
    border: none;                       /* cancels the black box from td{} */
    border-bottom: 1px solid #ccc;
    text-align: left;                   /* justified text looks bad when narrow */
    padding: .6rem;
    overflow-wrap: anywhere;            /* long words never force sideways scroll */
  }

  /* Small label above each field, taken from data-label in the PHP */
  .diary td::before {
    content: attr(data-label);
    display: block;
    font-size: .75rem;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: .04em;
    opacity: .7;
  }

  /* Date first, as the card heading */
  .diary .c-date { order: -1; font-weight: bold; background: rgba(0, 0, 0, .08); }

  /* Hide empty cells (most days have no appendices) */
  .diary td:empty { display: none; }

  /* Glossary: keep two columns (cards would be too long), just tighter */
  .glossary col:nth-child(1) { width: 32%; }
  .glossary col:nth-child(2) { width: 68%; }
  .glossary th { font-size: 16px; padding: 4px; }
  .glossary td {
    font-size: 15px;
    padding: 6px;
    text-align: left;
    overflow-wrap: anywhere;
  }

  /* Downloads: one full-width button per line */
  .download-row { flex-direction: column; gap: .5rem; margin-bottom: .5rem; }
  .download-row .LinkButton { text-align: center; }

  /* Individuals: shares the .diary card rules above.
     Full Title is the card heading; Rank, Last Name and (when there is no
     first name) Initials are hidden because Full Title already contains them. */
  .individuals .c-hide-m { display: none; }
  .individuals .c-title { order: -1; font-weight: bold; background: rgba(0, 0, 0, .08); }
}

/* ---------- OPTIONAL: safer font on phones ----------
   Many phones don't have Comic Sans MS, and your stacks end in "cursive",
   so those phones show whatever decorative handwriting font they map
   "cursive" to. For a transcribed historical record, plain sans-serif as
   the fallback may read better. Remove the comment markers to try it.

@media (max-width: 700px) {
  body, h1, h2, h3, h4, h5, p, th, td, label,
  .inputbox-size, .combo-size, .LinkButton, input[type=submit] {
    font-family: "Comic Sans MS", sans-serif;
  }
}
*/
