/*
  UMD Chemistry Portal theme.
#050405
  Ported from the Poster Print project's assets/css/source.css so the two apps look like one
  department. That project builds these rules with Tailwind 4; the portal is a static page with no
  build step, so the same tokens and components are written out as plain CSS here.

  UMD Design System tokens mirror @universityofmaryland/web-styles-library 1.8.17
  (dist/css/tokens.min.css). See https://designsystem.umd.edu.
*/

/* ---------------------------------------------------------------- tokens */

:root {
  /* Brand */
  --umd-red: #e21833;
  --umd-red-dark: #a90007;
  --umd-gold: #ffd200;
  --umd-blue: #2f7eda;
  --umd-green: #008000;
  --umd-black: #000000;
  --umd-white: #ffffff;
  --umd-gray-darker: #242424;
  --umd-gray-dark: #454545;
  --umd-gray-medium-aa: #757575;
  --umd-gray-medium: #7f7f7f;
  --umd-gray-light: #e6e6e6;
  --umd-gray-lighter: #f1f1f1;
  --umd-gray-lightest: #fafafa;

  /* Type. Interstate and Barlow Condensed load from vendor/umd/font-faces.min.css. */
  --font-sans: "Interstate", Helvetica, Arial, Verdana, sans-serif;
  --font-campaign: "Barlow Condensed", "Arial Narrow", sans-serif;
  --font-mono: ui-monospace, "Cascadia Mono", Consolas, "SF Mono", monospace;

  /* Spacing */
  --space-min: 8px;
  --space-xs: 12px;
  --space-sm: 16px;
  --space-md: 24px;
  --space-lg: 32px;
  --space-xl: 40px;
  --space-2xl: 48px;
  --space-3xl: 56px;
  --space-4xl: 64px;

  /* Matches the UMD header wrapper (wrapper=1100 in the campus header script). */
  --container-page: 1100px;

  /* Semantic, light. UMD guidance for light backgrounds: black titles, Dark Gray body copy,
     Maryland Red accents. */
  color-scheme: light;
  --ground: var(--umd-white);
  --surface: var(--umd-gray-lightest);
  --heading: var(--umd-black);
  --ink: var(--umd-gray-dark);            /* 9.58:1 on white */
  --muted: var(--umd-gray-medium-aa);     /* 4.6:1 on white */
  --line: var(--umd-gray-light);
  --field: var(--umd-gray-medium-aa);
  --accent: var(--umd-red);               /* 4.75:1 on white; white text on red */
  --accent-hover: var(--umd-red-dark);
  --accent-ink: var(--umd-white);

  /* Icon Card line art: Maryland Red on light, per the design system. */
  --icon-line: var(--umd-red);
}

/* Semantic, dark. UMD guidance for dark backgrounds: white text, Maryland Gold accents with
   black text on gold. */
:root.dark {
  color-scheme: dark;
  --ground: var(--umd-black);
  --surface: var(--umd-gray-darker);
  --heading: var(--umd-white);
  --ink: var(--umd-gray-lighter);
  --muted: #bdbdbd;                       /* 9.7:1 on Darker Gray */
  --line: var(--umd-gray-dark);
  --field: var(--umd-gray-medium);
  --accent: var(--umd-gold);              /* 14.47:1 on black */
  --accent-hover: var(--umd-white);
  --accent-ink: var(--umd-black);

  /* The dark icon card uses white line art, not the gold accent. */
  --icon-line: var(--umd-white);
}

/* ------------------------------------------------------------------ base */

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

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--ground);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

h1,
h2,
h3 {
  margin: 0;
  color: var(--heading);
  text-wrap: balance;
}

p {
  margin: 0;
}

ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

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

a {
  color: var(--accent);
  text-decoration: none;
  text-underline-offset: 2px;
}

a:hover {
  text-decoration: underline;
}

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

::selection {
  background: var(--accent);
  color: var(--accent-ink);
}

.page {
  width: 100%;
  max-width: var(--container-page);
  margin-inline: auto;
  padding-inline: var(--space-md);
}

.skip-link {
  position: absolute;
  left: -9999px;
}

.skip-link:focus {
  position: fixed;
  top: var(--space-xs);
  left: var(--space-xs);
  z-index: 100;
  background: var(--ground);
  padding: var(--space-min) var(--space-xs);
  font-weight: 700;
}

/* ------------------------------------------------------------------ type */

/* umd-campaign-large: Barlow Condensed bold italic caps, for the landing headline. */
.type-campaign {
  font-family: var(--font-campaign);
  font-size: 32px;
  line-height: 0.91;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  font-style: italic;
  color: var(--heading);
}

/* umd-sans-largest: page titles. */
.type-title {
  font-size: 22px;
  line-height: 1.25;
  font-weight: 700;
  color: var(--heading);
}

/* umd-sans-large: section headings. */
.type-subtitle {
  font-size: 18px;
  line-height: 1.25;
  font-weight: 700;
  color: var(--heading);
}

/* umd-sans-larger: intro paragraphs. */
.type-lede {
  font-size: 18px;
  line-height: 1.4;
}

/* umd-eyebrow: small uppercase labels. */
.type-eyebrow {
  font-size: 12px;
  line-height: 1.2;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.mono {
  font-family: var(--font-mono);
  font-size: 14px;
  font-variant-numeric: tabular-nums;
}

/* -------------------------------------------------------------- controls */

/* Calls to action: square, bold, Maryland Red (gold in dark mode). */
.btn {
  display: inline-flex;
  cursor: pointer;
  align-items: center;
  justify-content: center;
  gap: var(--space-min);
  border: 2px solid var(--accent);
  background: var(--accent);
  padding: 12px var(--space-md);
  font: inherit;
  font-size: 16px;
  line-height: 1;
  font-weight: 700;
  color: var(--accent-ink);
  text-decoration: none;
  transition: background-color 0.15s, border-color 0.15s, color 0.15s;
}

.btn:hover {
  border-color: var(--accent-hover);
  background: var(--accent-hover);
  text-decoration: none;
}

.btn-quiet {
  border-color: var(--heading);
  background: transparent;
  color: var(--heading);
}

.btn-quiet:hover {
  border-color: var(--heading);
  background: var(--heading);
  color: var(--ground);
}

/* Outline call to action, as the live booking table uses for each row. */
.btn-outline {
  border-color: var(--accent);
  background: transparent;
  color: var(--accent);
}

.btn-outline:hover {
  border-color: var(--accent);
  background: var(--accent);
  color: var(--accent-ink);
}

.btn-sm {
  padding: var(--space-min) var(--space-xs);
  font-size: 14px;
}

.nav-link {
  display: inline-block;
  border-bottom: 2px solid transparent;
  padding-block: 4px;
  font-weight: 700;
  color: var(--heading);
  text-decoration: none;
}

.nav-link:hover {
  border-bottom-color: var(--accent);
  text-decoration: none;
}

.nav-link[aria-current="page"] {
  border-bottom-color: var(--accent);
}

/* Square icon button, used for the theme toggle and the mobile menu. */
.icon-btn {
  display: inline-flex;
  width: 40px;
  height: 40px;
  cursor: pointer;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--field);
  background: var(--ground);
  color: var(--heading);
  transition: background-color 0.15s, border-color 0.15s, color 0.15s;
}

.icon-btn:hover {
  border-color: var(--heading);
  background: var(--heading);
  color: var(--ground);
}

.icon-btn svg {
  width: 18px;
  height: 18px;
}

/* Status chips: solid UMD colors, each pairing meets 4.5:1 on its own fill in both themes. */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px var(--space-min);
  font-size: 12px;
  line-height: 1;
  font-weight: 700;
  letter-spacing: 0.05em;
  white-space: nowrap;
  text-transform: uppercase;
}

.chip::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

.chip-secure {
  background: var(--umd-gold);
  color: var(--umd-black);
}

/* --------------------------------------------------------------- masthead */

.masthead {
  border-bottom: 1px solid var(--line);
  background: var(--ground);
}

.masthead > .page {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-sm) var(--space-lg);
  padding-block: var(--space-sm);
}

.masthead-logo {
  height: 36px;
}

:root:not(.dark) .when-dark,
:root.dark .when-light {
  display: none;
}

.wordmark {
  font-family: var(--font-campaign);
  font-size: 28px;
  line-height: 1;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  font-style: italic;
  color: var(--heading);
  text-decoration: none;
}

.wordmark:hover {
  text-decoration: none;
}

.masthead-nav {
  display: flex;
  flex: 1;
  flex-wrap: wrap;
  gap: var(--space-md);
}

.masthead-actions {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.menu-btn {
  display: inline-flex;
}

.mobile-nav {
  display: none;
  border-top: 1px solid var(--line);
  padding-block: var(--space-xs);
}

.mobile-nav[data-open="true"] {
  display: block;
}

.mobile-nav a {
  display: block;
  padding: var(--space-min) 0;
  font-weight: 700;
  color: var(--heading);
  text-decoration: none;
}

.mobile-nav a:hover {
  color: var(--accent);
}

/* ------------------------------------------------------------------ hero */

/* Always dark: white text with Maryland Gold accents, per UMD dark-background guidance. */
.hero {
  position: relative;
  background: var(--umd-black);
  padding-block: var(--space-2xl);
  border-bottom: 1px solid var(--umd-gray-dark);
}

:root.dark .hero {
  border-bottom-color: var(--umd-gold);
}

.hero .type-campaign {
  color: var(--umd-white);
}

.hero-accent {
  color: var(--umd-red);
}

.hero-body {
  max-width: 68ch;
  margin-top: var(--space-md);
  color: var(--umd-gray-lighter);
}

.hero-body strong {
  color: var(--umd-white);
}

.hero-body a {
  color: var(--umd-gold);
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-xs);
  margin-top: var(--space-lg);
}

/* The hero and band sit on black in both themes, so their buttons use the dark-background pairing. */
:is(.hero, .band) .btn {
  border-color: var(--umd-gold);
  background: var(--umd-gold);
  color: var(--umd-black);
}

:is(.hero, .band) .btn:hover {
  border-color: var(--umd-white);
  background: var(--umd-white);
}

:is(.hero, .band) .btn-quiet {
  border-color: var(--umd-white);
  background: transparent;
  color: var(--umd-white);
}

:is(.hero, .band) .btn-quiet:hover {
  background: var(--umd-white);
  color: var(--umd-black);
}

/*
  Photo hero. The image is set inline on the section; the scrim keeps white text legible over
  whatever the photo happens to be, and the black background shows through if it fails to load.
*/
.hero-image {
  background-color: var(--umd-black);
  background-size: cover;
  /* Matches the framing the live page used (object-position: 51.52% 1.63%). */
  background-position: 52% 2%;
  background-repeat: no-repeat;
}

.hero-image::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(to right, rgb(0 0 0 / 0.82) 0%, rgb(0 0 0 / 0.6) 50%, rgb(0 0 0 / 0.25) 100%);
}

.hero-image > .page {
  position: relative;
  z-index: 1;
}

/*
  On a phone the hero text wraps across the full width, so the gradient's light end no longer
  sits in empty space — it sits under the eyebrow. Measured at 375px, gold-on-photo fell to
  2.5:1 there. The scrim goes near-uniform below the desktop breakpoint.
*/
@media (max-width: 1023px) {
  .hero-image::before {
    background: linear-gradient(to right, rgb(0 0 0 / 0.88) 0%, rgb(0 0 0 / 0.8) 100%);
  }
}

/* ----------------------------------------------------------------- cards */

.section {
  padding-block: var(--space-2xl);
}

.section + .section {
  padding-top: 0;
}

.section-head {
  margin-bottom: var(--space-md);
  border-top: 2px solid var(--heading);
  padding-top: var(--space-xs);
}

.section-head .type-eyebrow {
  color: var(--heading);
}

.section-head p {
  margin-top: 4px;
  color: var(--muted);
  font-size: 14px;
}

.card-grid {
  display: grid;
  gap: var(--space-md);
  grid-template-columns: 1fr;
}

/*
  Icon Card, after https://designsystem.umd.edu/components/icon-card.

  The design system fills the card #FAFAFA on light and #242424 on dark, which are exactly this
  theme's --surface in each mode. The icon is right-aligned line art with no tile behind it, red
  on light and white on dark. There is no border and no hover fill; hover only wipes an underline
  across the title.
*/
/*
  The title sits to the left of the icon on one row; everything below it spans the full width.
  Grid rather than a wrapper element, so the markup keeps the design system's source order
  (icon first) while the icon still renders on the right of the title.
*/
.card {
  container-type: inline-size;
  display: grid;
  /* minmax(0, …) so a long unbreakable title can't force the row wider than the card. */
  grid-template-columns: minmax(0, 1fr) auto;
  column-gap: var(--space-xs);
  align-content: start;
  position: relative;
  height: 100%;
  overflow: hidden;
  background: var(--surface);
  padding: var(--space-sm) var(--space-md) var(--space-md);
  color: inherit;
  text-decoration: none;
}

.card > * {
  grid-column: 1 / -1;
}

a.card:hover {
  text-decoration: none;
}

.card-icon {
  display: flex;
  justify-content: flex-end;
  grid-column: 2;
  grid-row: 1;
  align-self: center;
}

.card-icon svg {
  width: 58px;
  height: 58px;
  max-height: 120px;
  color: var(--icon-line);
}

.card-title {
  grid-column: 1;
  grid-row: 1;
  align-self: center;
  font-size: 18px;
  line-height: 1.25em;
  font-weight: 700;
  color: var(--heading);
  text-wrap: pretty;
}

/* The design system scales the headline against the CARD's width, not the viewport's. */
@container (min-width: 320px) {
  .card-title {
    font-size: calc(18px + 0.5vw);
  }
}

@container (min-width: 650px) {
  .card-title {
    font-size: 32px;
  }
}

.card-title + * {
  margin-top: var(--space-sm);
}

/*
  UMD's hover animation: a 2px rule wipes in under the title. It is painted as a background
  gradient on an inline span, because a background on the block-level heading would stretch the
  full card width instead of tracking the text.
*/
.card-title > span:not(.flag) {
  display: inline;
  background-image: linear-gradient(var(--heading), var(--heading));
  background-position: left bottom;
  background-repeat: no-repeat;
  background-size: 0 2px;
  transition: background-size 0.5s;
}

a.card:hover .card-title > span:not(.flag),
a.card:focus-visible .card-title > span:not(.flag) {
  background-size: 100% 2px;
}

.card-desc {
  font-size: 16px;
  line-height: 1.5;
  color: var(--ink);
}

.card-subtitle {
  margin-top: 4px;
  font-size: 12px;
  line-height: 1.2;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
}

.card-links {
  display: grid;
  gap: var(--space-min);
  margin-top: var(--space-sm);
}

.card-links a {
  font-weight: 700;
}

/* Standing caveat under a card ("until further notice ..."). */
.card-note {
  margin-top: var(--space-sm);
  border-top: 1px solid var(--line);
  padding-top: var(--space-min);
  font-size: 13px;
  line-height: 1.45;
  color: var(--muted);
}

/* Small "limited access" marker, after the UMD flag style. */
.flag {
  display: inline-block;
  margin-left: 6px;
  padding: 2px 6px;
  font-size: 11px;
  line-height: 1;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  vertical-align: 2px;
}

.flag-warn {
  background: var(--umd-gold);
  color: var(--umd-black);
}

/* ---------------------------------------------------------------- alerts */

/* Content alerts: colored bar, icon, bold title (UMD Content Alert). */
.alert {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: start;
  gap: var(--space-xs);
  border-left: 4px solid var(--line);
  background: var(--surface);
  padding: var(--space-sm) var(--space-md);
  color: var(--ink);
}

.alert > svg {
  margin-top: 2px;
  width: 20px;
  height: 20px;
  flex: none;
}

.alert-title {
  margin-bottom: 4px;
  font-size: 18px;
  line-height: 1.25;
  font-weight: 700;
  color: var(--heading);
}

.alert p + p {
  margin-top: var(--space-min);
}

.alert-success {
  border-left-color: var(--umd-green);
}

.alert-success > svg {
  color: var(--umd-green);
}

:root.dark .alert-success > svg {
  color: var(--umd-white);
}

.alert-error {
  border-left-color: var(--umd-red);
}

.alert-error > svg {
  color: var(--umd-red);
}

.alert-warn {
  border-left-color: var(--umd-gold);
}

.alert-warn > svg {
  color: var(--umd-black);
}

:root.dark .alert-warn > svg {
  color: var(--umd-gold);
}

.alert-info {
  border-left-color: var(--umd-blue);
}

.alert-info > svg {
  color: var(--umd-blue);
}

/* ---------------------------------------------------------------- footer */

.site-footer {
  margin-top: auto;
  border-top: 4px solid var(--umd-red);
  background: var(--umd-black);
  color: var(--umd-gray-lighter);
  padding-block: var(--space-lg);
}

.site-footer > .page {
  display: grid;
  gap: var(--space-md);
}

.site-footer .type-eyebrow {
  color: var(--umd-white);
  margin-bottom: var(--space-min);
}

.site-footer address {
  font-style: normal;
  font-size: 14px;
  line-height: 1.6;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm) var(--space-md);
  font-size: 14px;
}

.site-footer a {
  color: var(--umd-white);
  font-weight: 700;
  text-decoration: none;
}

.site-footer a:hover {
  text-decoration: underline;
}

.footer-legal {
  border-top: 1px solid var(--umd-gray-dark);
  padding-top: var(--space-sm);
  font-size: 12px;
  color: var(--umd-gray-light);
}

/* ------------------------------------------------------- UMD breakpoints */

@media (min-width: 768px) {
  .type-campaign {
    font-size: 48px;
  }

  .type-title {
    font-size: 32px;
  }

  .type-lede {
    font-size: 20px;
  }

  .card-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .site-footer > .page {
    grid-template-columns: 1fr 1fr;
  }

  .footer-legal {
    grid-column: 1 / -1;
  }
}

@media (min-width: 1024px) {
  .type-campaign {
    font-size: 80px;
  }

  .type-title {
    font-size: 44px;
    line-height: 1.04;
  }

  .type-lede {
    font-size: 22px;
    line-height: 1.25;
  }

  .card-grid {
    grid-template-columns: repeat(4, 1fr);
  }

  .card-grid-3 {
    grid-template-columns: repeat(3, 1fr);
  }

  .menu-btn {
    display: none;
  }

  .mobile-nav {
    display: none !important;
  }
}

@media (max-width: 1023px) {
  .masthead-nav {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
  }
}

/* ----------------------------------------------------------------- table */

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.table-scroll {
  overflow-x: auto;
}

/* Tables: black rule and eyebrow headers, hairlines between rows.
   Ported from the poster project's .data-table. */
.data-table {
  width: 100%;
  border-collapse: collapse;
}

.data-table th {
  border-bottom: 2px solid var(--heading);
  padding: var(--space-xs) var(--space-min);
  text-align: left;
  font-size: 12px;
  line-height: 1.2;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: var(--heading);
  text-transform: uppercase;
}

.data-table td {
  border-bottom: 1px solid var(--line);
  padding: 14px var(--space-min);
  vertical-align: middle;
}

.data-table tbody tr:hover {
  background: var(--surface);
}

.data-table .mono {
  white-space: nowrap;
}

.data-table .num {
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.data-table .tight {
  font-size: 14px;
  line-height: 1.45;
  color: var(--muted);
}

/* Gold group heading, after the bar the live page uses (with the real UMD gold). */
.eyebrow-bar {
  display: inline-block;
  margin-bottom: var(--space-xs);
  background: var(--umd-gold);
  padding: 6px var(--space-sm);
  color: var(--umd-black);
}

.table-group + .table-group {
  margin-top: var(--space-xl);
}

/*
  Under the desktop breakpoint the table stacks into labelled blocks, which is how the live page
  behaves. Seven columns of equipment prose do not survive a 375px viewport as a table.
*/
@media (max-width: 1023px) {
  .data-table,
  .data-table tbody,
  .data-table tr,
  .data-table td {
    display: block;
    width: 100%;
  }

  .data-table thead {
    display: none;
  }

  .data-table tr {
    border-bottom: 1px solid var(--line);
    padding-block: var(--space-xs);
  }

  .data-table td {
    border: 0;
    padding: 3px 0;
  }

  .data-table td::before {
    content: attr(data-label) ": ";
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--heading);
  }

  .data-table td:empty,
  .data-table td[data-label=""]::before {
    display: none;
  }

  .data-table .num {
    text-align: left;
  }
}

/* ------------------------------------------------------------------ band */

/* Dark promo band, after the live page's umd-element-banner-promo. */
.band {
  background: var(--umd-black);
  color: var(--umd-gray-lighter);
  padding-block: var(--space-xl);
}

.band .type-title,
.band .type-subtitle {
  color: var(--umd-white);
}

.band a:not(.btn) {
  color: var(--umd-gold);
}

.band-body {
  max-width: 68ch;
  margin-top: var(--space-min);
}

.band-actions {
  margin-top: var(--space-md);
}
