/*
  mobile.css
  Responsive improvements for smaller screens.

  Load this file AFTER your normal style.css:
  <link rel="stylesheet" href="style.css">
  <link rel="stylesheet" href="mobile.css">
*/

/* Make sizing more predictable */
*,
*::before,
*::after {
  box-sizing: border-box;
}

/* Prevent the page from becoming wider than the phone screen */
html,
body {
  max-width: 100%;
  overflow-x: hidden;
}

/* Make images, videos, and embedded content fit their containers */
img,
video,
iframe,
object,
embed {
  max-width: 100%;
  height: auto;
}

/* Improve readability on phones */
body {
  font-size: 16px;
  line-height: 1.5;
}

/* Common page wrappers */
.container,
.wrapper,
.page,
.content,
main {
  max-width: 100%;
}

/* Prevent wide tables from breaking the page */
table {
  max-width: 100%;
}

/* Make long words and URLs wrap instead of creating horizontal scrolling */
p,
h1,
h2,
h3,
h4,
h5,
h6,
li,
a {
  overflow-wrap: anywhere;
}

/* Give links and buttons a comfortable touch target */
a,
button,
input[type="submit"],
input[type="button"],
input[type="reset"] {
  min-height: 44px;
}

/* Phone-specific layout changes */
@media screen and (max-width: 700px) {
  body {
    margin: 0;
    padding: 0;
  }

  /* Reduce large desktop-style spacing */
  .container,
  .wrapper,
  .page,
  .content,
  main {
    width: auto;
    margin-left: 16px;
    margin-right: 16px;
    padding-left: 0;
    padding-right: 0;
  }

  /* Scale headings for narrow screens */
  h1 {
    font-size: 1.8rem;
    line-height: 1.2;
  }

  h2 {
    font-size: 1.5rem;
    line-height: 1.25;
  }

  h3 {
    font-size: 1.25rem;
    line-height: 1.3;
  }

  /* Stack common two-column layouts */
  .columns,
  .two-columns,
  .three-columns,
  .row,
  .flex-row,
  .content-area,
  .sidebar-layout {
    display: block;
    width: 100%;
  }

  /* Prevent old fixed-width elements from breaking the phone layout */
  .columns > *,
  .two-columns > *,
  .three-columns > *,
  .row > *,
  .flex-row > *,
  .content-area > *,
  .sidebar-layout > * {
    width: 100%;
    max-width: 100%;
    margin-left: 0;
    margin-right: 0;
  }

  /* Make navigation links easier to tap */
  nav ul {
    margin: 0;
    padding: 0;
    list-style: none;
  }

  nav li {
    display: block;
    margin: 0;
  }

  nav a {
    display: block;
    padding: 12px 8px;
  }

  /* Make form controls fit the screen */
  form,
  fieldset,
  input,
  select,
  textarea,
  button {
    max-width: 100%;
  }

  input,
  select,
  textarea {
    width: 100%;
    min-height: 44px;
    font-size: 16px;
  }

  textarea {
    min-height: 120px;
  }

  button,
  input[type="submit"],
  input[type="button"],
  input[type="reset"] {
    width: auto;
    padding: 10px 18px;
    font-size: 16px;
    cursor: pointer;
  }

  /* Allow a wide data table to scroll horizontally */
  .table-wrapper {
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  /* Reduce large banners and decorative spacing */
  .hero,
  .banner,
  .header-image {
    min-height: 0;
    height: auto;
    padding: 32px 16px;
  }

  /* Keep footer content readable */
  footer {
    height: auto;
    padding: 24px 16px;
  }
}

/* Very small phones */
@media screen and (max-width: 400px) {
  .container,
  .wrapper,
  .page,
  .content,
  main {
    margin-left: 12px;
    margin-right: 12px;
  }

  h1 {
    font-size: 1.55rem;
  }

  h2 {
    font-size: 1.3rem;
  }
}