/*
  mystyle.css - accessibility-focused replacement
  Target: Davar Khoshnevisan math.utah.edu pages
  Goal: improve ADA/WCAG-oriented visual accessibility without requiring HTML changes.

  Notes:
  - CSS alone cannot guarantee ADA/WCAG compliance. HTML semantics, alt text,
    document titles, headings, forms, and keyboard behavior must also be checked.
  - This stylesheet avoids fixed text sizes, keeps links visually identifiable,
    adds strong keyboard focus styles, and uses high-contrast color pairs.
*/

:root {
  color-scheme: light;

  --page-bg: #f8fafc;
  --page-bg-image: none;
  --photo-bg-image: url("Moab_Arches_2018.jpg");
  --photo-opacity: 0.26;
  --body-bg: rgba(255, 255, 255, 0.975);
  --content-bg: #ffffff;
  --body-border: rgba(203, 213, 225, 0.9);
  --body-shadow: 0 1rem 2.5rem rgba(15, 23, 42, 0.36);
  --text: #111827;
  --muted-text: #334155;
  --heading: #0f172a;
  --border: #cbd5e1;

  --link: #111827;
  --link-hover: #111827;
  --link-visited: #111827;
  --focus: #92400e;
  --focus-bg: rgba(146, 64, 14, 0.12);

  --notice-bg: #fff7ed;
  --notice-text: #7c2d12;

  --measure: 80ch;
  --body-font: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, "Noto Sans", "Liberation Sans", sans-serif;
  --body-font-size: 1rem; /* Browser default: 16px unless the user has changed their default font size. */
}

* {
  box-sizing: border-box;
}

html {
  position: relative;
  min-height: 100%;
  font-size: 100%;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  background-color: var(--page-bg);
  background-image: var(--page-bg-image);
}

/* Faint grayscale photo layer behind the page. */
html::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(248, 250, 252, 0.30), rgba(248, 250, 252, 0.30)),
    var(--photo-bg-image);
  background-repeat: no-repeat;
  background-position: center top;
  background-size: cover;
  opacity: var(--photo-opacity);
  filter: grayscale(100%) contrast(0.95) brightness(0.88);
}

body {
  position: relative;
  z-index: 1;
  margin: clamp(1rem, 3vw, 2rem) auto;
  padding: clamp(1.25rem, 3vw, 2.25rem);
  max-width: var(--measure);
  min-height: calc(100vh - clamp(2rem, 6vw, 4rem));
  border: 1px solid var(--body-border);
  border-radius: 0.6rem;
  box-shadow: var(--body-shadow);
  background: var(--body-bg);
  color: var(--text);
  font-family: var(--body-font);
  font-size: var(--body-font-size);
  line-height: 1.65;
}

main,
article,
section,
.content,
.container,
#content,
#main,
table {
  max-width: 100%;
}

h1,
h2,
h3,
h4,
h5,
h6 {
  color: var(--heading);
  line-height: 1.25;
  margin-block: 1.25em 0.5em;
}

h1 {
  font-size: clamp(1.8rem, 3.2vw, 2.4rem);
}

h2 {
  font-size: clamp(1.35rem, 2.4vw, 1.75rem);
}

p,
ul,
ol,
dl,
pre,
blockquote,
figure,
table {
  margin-block: 0 1rem;
}

ul,
ol {
  padding-inline-start: 1.5rem;
}

li + li {
  margin-top: 0.35rem;
}

/* Links are underlined by default so color is not the only cue. */
a {
  color: var(--link);
  text-decoration-line: underline;
  text-decoration-thickness: 0.09em;
  text-underline-offset: 0.16em;
  overflow-wrap: anywhere;
}

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

a:hover,
a:active {
  color: var(--link-hover);
  text-decoration-thickness: 0.14em;
}

a:focus-visible {
  border-radius: 0.15em;
  background-color: var(--focus-bg);
}

/* Strong visible keyboard focus. */
a:focus,
button:focus,
input:focus,
select:focus,
textarea:focus,
summary:focus,
[tabindex]:focus {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
}

:focus:not(:focus-visible) {
  outline: none;
}

:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
}

nav a,
.nav a,
.navigation a,
.footer a,
footer a,
p > a,
li > a {
  padding-block: 0.08rem;
}

button,
input,
select,
textarea {
  font: inherit;
  color: var(--text);
}

button,
input[type="button"],
input[type="submit"],
input[type="reset"] {
  min-height: 2.75rem;
  min-width: 2.75rem;
  padding: 0.55rem 0.85rem;
  border: 2px solid var(--heading);
  border-radius: 0.25rem;
  background: var(--content-bg);
  cursor: pointer;
}

input,
select,
textarea {
  min-height: 2.75rem;
  max-width: 100%;
  border: 2px solid var(--border);
  border-radius: 0.25rem;
  background: var(--content-bg);
  padding: 0.45rem 0.6rem;
}

textarea {
  min-height: 8rem;
}

label {
  display: inline-block;
  margin-block: 0.5rem 0.25rem;
  font-weight: 700;
}

img,
svg,
video,
canvas {
  max-width: 100%;
  height: auto;
}

img {
  border: 0;
}

figure {
  margin-inline: 0;
}

figcaption,
small,
.footer,
footer,
address {
  color: var(--muted-text);
  font-size: 0.95em;
}

address {
  font-style: normal;
}

/* Tables remain readable on small screens and at 200% zoom. */
table {
  border-collapse: collapse;
  width: 100%;
  overflow-x: auto;
}

th,
td {
  padding: 0.5rem;
  border: 1px solid var(--border);
  vertical-align: top;
  text-align: left;
}

th {
  background: #e5e7eb;
  color: var(--heading);
}

code,
kbd,
samp,
pre {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  font-size: 0.95em;
}

pre {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  padding: 1rem;
  border: 1px solid var(--border);
  background: var(--content-bg);
}

blockquote {
  margin-inline: 0;
  padding-inline: 1rem;
  border-left: 0.25rem solid var(--border);
  color: var(--muted-text);
}

hr {
  border: 0;
  border-top: 1px solid var(--border);
  margin-block: 1.5rem;
}

.skip-link {
  position: absolute;
  inset-block-start: 0.5rem;
  inset-inline-start: 0.5rem;
  z-index: 999;
  transform: translateY(-150%);
  padding: 0.75rem 1rem;
  border: 2px solid var(--heading);
  background: var(--content-bg);
  color: var(--link);
}

.skip-link:focus,
.skip-link:focus-visible {
  transform: translateY(0);
}

/* Page-specific homepage helpers. */
.profile-with-photo {
  display: grid;
  grid-template-columns: 112px minmax(0, 1fr);
  column-gap: 1rem;
  align-items: start;
  margin-block-end: 0.5rem;
}

.profile-photo {
  inline-size: 112px;
  block-size: auto;
  aspect-ratio: 4 / 5;
  object-fit: cover;
  align-self: start;
  border-radius: 0.75rem;
  border: 1px solid rgba(17, 24, 39, 0.24);
  box-shadow: 0 0.35rem 1rem rgba(15, 23, 42, 0.18);
}

.profile-intro {
  margin-block-start: 0;
  min-width: 0;
}

.profile-name {
  margin: 0;
  font-size: clamp(1.5rem, 2.8vw, 2.1rem);
  font-weight: 700;
  line-height: 1.05;
}

.profile-name a {
  color: inherit;
  text-decoration: none;
}

.profile-name a:hover,
.profile-name a:focus,
.profile-name a:focus-visible {
  color: inherit;
  text-decoration: underline;
}

.profile-affiliation {
  margin: 0.25rem 0 0;
  line-height: 1.4;
}

.profile-links {
  margin-block-start: 0.2rem;
  line-height: 1.5;
}

.personal-note {
  margin-block-start: 0.3rem;
}

.personal-web-page {
  font-weight: 700;
  color: #b91c1c;
}

.personal-web-page:visited,
.personal-web-page:hover,
.personal-web-page:active,
.personal-web-page:focus,
.personal-web-page:focus-visible {
  color: #b91c1c;
}

.section-title {
  margin-block: 0;
}

.section-note {
  font-weight: 400;
}

.notes-list {
  margin-block-start: 0.5rem;
}

.notes-list li + li {
  margin-top: 0.45rem;
}

.see-also {
  margin-block: 0.85rem 0;
}

.updated,
.copyright {
  margin-block: 0.75rem 0;
}

.updated {
  font-size: 1.05em;
}

.copyright {
  margin-block-end: 0;
}

.footer-links {
  text-align: center;
}

.footer-address {
  text-align: center;
  margin-block-start: 0.75rem;
}

.notice,
.warning,
.important {
  padding: 1rem;
  border: 2px solid var(--focus);
  border-radius: 0.25rem;
  background: var(--notice-bg);
  color: var(--notice-text);
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}

@media (forced-colors: active) {
  html,
  body {
    background: Canvas;
    background-image: none;
    border-color: CanvasText;
    box-shadow: none;
  }

  html::before {
    display: none;
  }

  a {
    color: LinkText;
  }

  a:visited {
    color: VisitedText;
  }

  a:focus,
  button:focus,
  input:focus,
  select:focus,
  textarea:focus,
  summary:focus,
  [tabindex]:focus,
  :focus-visible {
    outline: 3px solid Highlight;
  }
}

@media (max-width: 40rem) {
  body {
    margin: 0 auto;
    min-height: 100vh;
    padding: 1rem;
    border-width: 0;
    border-radius: 0;
  }

  .profile-with-photo {
    display: block;
  }

  .profile-photo {
    display: block;
    inline-size: min(100%, 112px);
    margin-block-end: 0.75rem;
  }

  nav,
  .nav,
  .navigation,
  footer,
  .footer {
    line-height: 1.8;
  }
}

