/*
====================================================
DoseClock Base Styles
Accessibility-first clinical UI foundation
Package 2: reorganised base layer

Purpose:
- Keep global typography, layout, cards, tables, media, and focus rules here.
- Move button-specific rules to buttons.css.
- Move form-specific rules to forms.css.
- Do not target .tile here because homepage tiles/buttons have their own legacy styling.
====================================================
*/

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  padding: 0;
  font-family:
    "Atkinson Hyperlegible",
    "Inter",
    "Segoe UI",
    sans-serif;
  font-size: 1rem;
  line-height: 1.6;
  background-color: var(--color-background, var(--page-bg, #eef3f9));
  color: var(--color-text, var(--text, #18212f));
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

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

/*
====================================================
Typography
====================================================
*/

h1,
h2,
h3,
h4,
h5,
h6 {
  margin-top: 0;
  font-weight: 700;
  line-height: 1.25;
  color: var(--color-heading, var(--text, #18212f));
}

h1 {
  font-size: clamp(1.7rem, 2.3vw, 2.15rem);
}

h2 {
  font-size: clamp(1.45rem, 1.9vw, 1.75rem);
}

h3 {
  font-size: clamp(1.25rem, 1.5vw, 1.45rem);
}

p {
  margin-top: 0;
  margin-bottom: 1rem;
}

p,
li,
td,
th {
  font-size: 1rem;
}

strong,
b {
  font-weight: 800;
}

.small,
.text-muted,
.help-text,
.form-text {
  color: var(--text-muted, #526174) !important;
}

.medication-name,
.med-name,
.schedule-med-name {
  font-size: 1.08rem;
  font-weight: 900;
  color: var(--color-text, var(--text, #18212f));
}

.dose,
.med-dose,
.schedule-dose {
  font-size: 1.02rem;
  font-weight: 800;
  color: var(--text-muted, #526174);
}

/*
====================================================
Links
====================================================
*/

a {
  color: var(--color-primary, var(--primary, #0a2d6f));
  text-underline-offset: 0.18em;
}

a:hover {
  text-decoration: underline;
}

/*
====================================================
Main layout
====================================================
*/

.page-main {
  width: min(100% - 2rem, var(--container-max, 1180px));
  margin-inline: auto;
  padding-top: 6rem;
  padding-left: 1rem;
  padding-right: 1rem;
}

.site-header {
  box-shadow: var(--shadow-sm, 0 2px 8px rgba(15, 23, 42, 0.06));
}

.site-nav__link,
.site-nav__logout {
  min-height: var(--touch-target-min, 44px);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  font-weight: 700;
}

/*
====================================================
Cards / Panels
====================================================
*/

.card,
.panel,
.content-card,
.med-card,
.stock-card,
.log-card,
.audit-card,
.dashboard-card {
  background: var(--surface, #ffffff);
  color: var(--color-text, var(--text, #18212f));
  border: 1px solid var(--color-border, var(--border, #d7e0eb));
  border-radius: var(--radius-lg, 18px);
  box-shadow: var(--shadow-sm, 0 2px 8px rgba(15, 23, 42, 0.06));
}

.alert,
.flash,
.message,
.notice {
  border-radius: var(--radius, 14px);
  border-width: 1px;
  font-weight: 700;
}

.badge,
.status-badge,
.pill {
  border-radius: var(--radius-pill, 999px);
  font-weight: 800;
}

/*
====================================================
Tables
====================================================
*/

table,
.table {
  width: 100%;
  border-collapse: collapse;
  vertical-align: middle;
}

th,
.table th {
  text-align: left;
  font-weight: 900;
  color: var(--color-text, var(--text, #18212f));
}

th,
td,
.table th,
.table td {
  padding: 0.8rem;
}

tbody tr:nth-child(even) {
  background-color: var(--table-row-alt, #f7f9fc);
}

tbody tr:hover {
  background-color: var(--table-row-hover, #ecf2fb);
}

/*
====================================================
Accessibility
====================================================
*/

:focus-visible {
  outline: 3px solid var(--color-primary, var(--primary, #0a2d6f));
  outline-offset: 2px;
}

a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
summary:focus-visible,
[tabindex]:focus-visible {
  box-shadow: var(--focus-ring, 0 0 0 4px rgba(43, 140, 255, 0.28));
}

::selection {
  background: rgba(43, 140, 255, 0.24);
}

/*
====================================================
Responsive media
====================================================
*/

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

@media (prefers-reduced-motion: reduce) {

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}

@media (max-width: 768px) {
  body {
    font-size: 1rem;
  }

  h1 {
    font-size: 1.7rem;
  }

  h2 {
    font-size: 1.5rem;
  }

  .page-main {
    width: 100%;
    padding-top: 5.25rem;
    padding-left: 0.9rem;
    padding-right: 0.9rem;
  }
}

@media print {
  body {
    background: #ffffff;
    color: #000000;
  }

  .site-header,
  .site-nav,
  .no-print,
  button,
  .btn,
  .button {
    display: none !important;
  }

  .page-main {
    width: 100%;
    padding: 0;
  }
}

/*
====================================================
Header spacing fix
Stops the fixed header/logo from covering page titles
====================================================
*/

.page-main {
  padding-top: 9rem;
}

@media (max-width: 768px) {
  .page-main {
    padding-top: 10rem;
  }
}