/* ============================================================================
 * BASE STYLES
 * ----------------------------------------------------------------------------
 * Consumes ONLY design tokens from tokens.css. No raw hex values or font
 * names here — that rule is what makes future theming a data change.
 * ========================================================================== */

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

html {
  font-size: var(--font-size-base);
}

body {
  margin: 0;
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: var(--line-height-base);
  color: var(--color-text);
  background: var(--color-background);
}

h1, h2, h3, h4 {
  font-family: var(--font-heading);
  font-weight: var(--font-weight-bold);
  line-height: 1.2;
  margin: 0 0 var(--space-4);
}

h1 { font-size: var(--font-size-2xl); }
h2 { font-size: var(--font-size-xl); }
h3 { font-size: var(--font-size-lg); }

p { margin: 0 0 var(--space-4); }

a {
  color: var(--color-link);
  text-decoration: none;
}
a:hover {
  color: var(--color-link-hover);
  text-decoration: underline;
}

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

.container {
  max-width: var(--max-content-width);
  margin: 0 auto;
  padding: var(--space-8) var(--space-4);
}

.card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  padding: var(--space-8);
}

.muted { color: var(--color-text-muted); }

/* Add-to-calendar-style button — driven entirely by button tokens. */
.btn {
  display: inline-block;
  font-family: var(--font-body);
  font-weight: var(--button-font-weight);
  color: var(--color-button-text);
  background: var(--color-button-bg);
  border: none;
  border-radius: var(--button-radius);
  padding: var(--button-padding-y) var(--button-padding-x);
  cursor: pointer;
  transition: background-color 0.15s ease;
}
.btn:hover {
  background: var(--color-button-bg-hover);
  text-decoration: none;
  color: var(--color-button-text);
}

/* Accent button — dark text on the accent color for a readable contrast ratio
   (white on gold/amber fails WCAG). Works across per-calendar accent colors. */
.btn-accent {
  background: var(--color-accent);
  color: var(--color-text);
}
.btn-accent:hover {
  background: var(--color-accent-hover);
  color: var(--color-text);
}

/* Screen-reader-only text: present for assistive tech, invisible on screen. */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Skip-to-content link: hidden until focused, then visible at top-left. */
.skip-link {
  position: absolute;
  left: var(--space-2);
  top: -3rem;
  z-index: 2000;
  background: var(--color-surface);
  color: var(--color-link);
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  transition: top 0.15s ease;
}
.skip-link:focus {
  top: var(--space-2);
}

/* Event chip preview (mirrors how FullCalendar events will be tinted). */
.event-chip {
  display: inline-block;
  background: var(--color-event);
  color: var(--color-event-text);
  border-radius: var(--radius-sm);
  padding: var(--space-1) var(--space-3);
  font-size: var(--font-size-sm);
}
.event-chip.members {
  background: var(--color-event-members);
}

/* Small swatch grid used on the Phase 0 status page to prove tokens render. */
.swatches {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: var(--space-3);
  margin-top: var(--space-4);
}
.swatch {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  overflow: hidden;
  font-size: var(--font-size-sm);
}
.swatch .chip {
  height: 56px;
}
.swatch .label {
  padding: var(--space-2) var(--space-3);
  background: var(--color-surface);
}

/* ============================================================================
 * RESPONSIVE  — tablet (iPad) + phone
 * ----------------------------------------------------------------------------
 * The layout is fluid (flex-wrap), so these rules mostly reclaim space and
 * scale type down on smaller screens, and keep the calendar usable on a phone.
 * ========================================================================== */

/* Media never forces the page wider than the screen. */
img,
svg,
video {
  max-width: 100%;
  height: auto;
}

/* Long unbreakable strings (emails, URLs, tokens) wrap instead of overflowing. */
.card {
  overflow-wrap: break-word;
}

/* Headings shrink gracefully on narrow screens instead of overflowing. */
h1 { font-size: clamp(1.6rem, 5.5vw, var(--font-size-2xl)); }
h2 { font-size: clamp(1.35rem, 4.5vw, var(--font-size-xl)); }

/* FullCalendar: let the toolbar wrap and breathe on small screens. */
.fc .fc-toolbar.fc-header-toolbar {
  flex-wrap: wrap;
  gap: var(--space-2);
}
.fc .fc-toolbar-title {
  font-size: var(--font-size-lg);
}

/* Tablet / small laptop */
@media (max-width: 768px) {
  .container { padding: var(--space-6) var(--space-3); }
  .card { padding: var(--space-6); }
}

/* Phone */
@media (max-width: 480px) {
  .container { padding: var(--space-4) var(--space-3); }
  .card { padding: var(--space-4); }
  .fc .fc-toolbar-title { font-size: var(--font-size-base); }
  /* Shrink the view buttons so nav + Month/Week/Day/List fit a phone row. */
  .fc .fc-button {
    padding: 0.3em 0.55em;
    font-size: 0.82rem;
  }
}
