/*
 * Mobile-first stylesheet for the NCAA Rules and Case Book site.
 * The site is read primarily on modern phones (iPhone first, then Android), so
 * base styles target a one-handed phone reading experience and larger screens
 * are treated as progressive enhancements. See requirements.md > Presentation.
 */

:root {
  --text: #1a1a1a;
  --muted: #5a5a5a;
  --link: #0b5cab;
  --link-visited: #6b3fa0;
  --bg: #ffffff;
  --border: #d9dee5;
  --measure: 44rem; /* readable line length on tablet/desktop */
}

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

html {
  /* Stop iOS Safari from auto-enlarging text in landscape. */
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0 auto;
  max-width: var(--measure);
  padding: 0 calc(1rem + env(safe-area-inset-right)) 4rem calc(1rem + env(safe-area-inset-left));
  background: var(--bg);
  color: var(--text);
  font-family:
    -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, system-ui, "Helvetica Neue", Arial,
    sans-serif;
  font-size: 1.0625rem; /* ~17px on phones */
  line-height: 1.6;
  overflow-wrap: break-word;
  word-break: break-word;
}

@media (min-width: 40rem) {
  body {
    font-size: 1.125rem; /* ~18px with more room to breathe */
  }
}

/* Keep anchored targets clear of the sticky top bar when jumping to a link. */
[id] {
  scroll-margin-top: 4rem;
}

/* Top navigation bar: the first unclassed div on rules/cases pages. Scoped to
   :first-of-type so the index list's unclassed wrapper div is not made sticky,
   and so the index pages' .container div (which has a class) is left alone. */
body > div:not([class]):first-of-type {
  position: sticky;
  top: 0;
  z-index: 10;
  margin: 0 0 1rem;
  padding: 0.6rem 0;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  font-weight: 600;
}

body > div:not([class]):first-of-type a {
  display: inline-block;
  padding: 0.4rem 0.3rem;
}

/* Links are the primary interaction: readable color, clear underline, and
   enough padding/line spacing to be tappable one-handed in dense rule text. */
a {
  color: var(--link);
  text-decoration: underline;
  text-underline-offset: 0.15em;
}

a:visited {
  color: var(--link-visited);
}

a:focus-visible {
  outline: 3px solid var(--link);
  outline-offset: 2px;
  border-radius: 2px;
}

h1,
h2,
h3 {
  line-height: 1.25;
}

h1 {
  font-size: 1.5rem;
  margin: 1.8rem 0 0.75rem;
}

h2 {
  font-size: 1.2rem;
  margin: 1.4rem 0 0.6rem;
}

h1 a,
h2 a {
  text-decoration: none;
}

h1 a:hover,
h2 a:hover {
  text-decoration: underline;
}

p {
  margin: 0 0 0.9rem;
}

/* Index and season-selector lists: give each item a tap-friendly target. */
ul {
  padding-left: 1.25rem;
}

li {
  margin: 0.45rem 0;
}

li a {
  display: inline-block;
  padding: 0.25rem 0;
}

.container .unavailable,
.unavailable {
  color: var(--muted);
}

/* Structural indentation. Phones get tighter indents to preserve width; larger
   screens restore the original, roomier indentation. */
.ar_content {
  margin-left: 1rem;
}

.ruling {
  font-weight: bold;
  margin-left: 1.5rem;
}

@media (min-width: 40rem) {
  .ar_content {
    margin-left: 20px;
  }

  .ruling {
    margin-left: 40px;
  }
}

.note {
  font-style: italic;
  color: var(--muted);
}

.exception {
  font-style: italic;
}

/* Landing page: lead with the current season and tuck older ones away. */
.current-season {
  margin: 1.5rem 0;
  padding: 1rem 1.25rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #f6f8fa;
}

.current-season h2 {
  margin-top: 0;
}

.book-links a {
  display: inline-block;
  padding: 0.5rem 0.4rem;
  font-size: 1.125rem;
}

.past-seasons {
  margin-top: 1.5rem;
  color: var(--muted);
}

.past-seasons summary {
  cursor: pointer;
  padding: 0.5rem 0;
  font-weight: 600;
}

.past-seasons li {
  margin: 0.6rem 0;
}

.past-seasons a {
  display: inline-block;
  padding: 0.25rem 0.3rem;
}
