/* ==========================================================================
   Layout & Core Structure
   ========================================================================== */

.hidden {
  display: none !important;
}

body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  overflow-x: hidden;
  max-width: 100%;
}

main {
  flex: 1;
  width: 100%;
  overflow-x: hidden;
}

/* ==========================================================================
   Typography Defaults
   ========================================================================== */
h1,
h2,
h3,
h4,
h5,
h6 {
  font-family: inherit;
  color: var(--t-on-surface);
  line-height: 1.2;
  margin-bottom: 1rem;
}

h1 {
  font-size: var(--fs-h1);
  font-weight: 700;
  letter-spacing: -0.025em;
  line-height: 1.15;
}

h2 {
  font-size: var(--fs-h2);
  font-weight: 600;
  letter-spacing: -0.015em;
  line-height: 1.2;
}

h3 {
  font-size: var(--fs-h3);
  font-weight: 600;
}

h4 {
  font-size: 1.25rem;
  font-weight: 600;
}

p {
  margin-bottom: 1rem;
  color: var(--text-main);
  line-height: 1.7;
}

a {
  color: var(--brand-green);
  transition: color 0.2s;
}

a:hover {
  color: var(--t-primary);
}

/* ==========================================================================
   Container
   ========================================================================== */
.container {
  max-width: var(--container-width);
  margin-left: auto;
  margin-right: auto;
  padding-left: 1.5rem;
  padding-right: 1.5rem;
  padding-top: 2rem;
  padding-bottom: 3rem;
  width: 100%;
}

/* ==========================================================================
   Responsive Container
   ========================================================================== */
.t-container {
  width: 100%;
  margin-inline: auto;
  padding-inline: var(--space-4, 1rem);
}

@media (min-width: 640px) {
  .t-container {
    max-width: 640px;
  }
}

@media (min-width: 768px) {
  .t-container {
    max-width: 768px;
  }
}

@media (min-width: 1024px) {
  .t-container {
    max-width: 1024px;
  }
}

@media (min-width: 1280px) {
  .t-container {
    max-width: 1280px;
  }
}

@media (min-width: 1536px) {
  .t-container {
    max-width: 1680px;
  }
}

/* ==========================================================================
   Surface Box (Card) Pattern
   ========================================================================== */
.surface-box {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: 1.5rem;
  margin-bottom: 2rem;
}

/* ==========================================================================
   Page Header
   ========================================================================== */
.page-header {
  margin-bottom: 2rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border-light);
}

/* ==========================================================================
   Privacy Banner
   ========================================================================== */
.privacy-banner {
  display: flex;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--bg-card);
  border-top: 1px solid var(--border-light);
  box-shadow: 0 -4px 20px rgb(0 0 0 / 0.1);
  padding: 1.25rem 1.5rem;
  z-index: 3000;
  animation: slideUp 0.3s ease-out;
}

.privacy-banner .privacy-banner-title {
  font-weight: 700;
  font-size: 1rem;
  color: var(--t-on-surface);
  margin-bottom: 0.5rem;
}

.privacy-banner .privacy-banner-desc {
  font-size: 0.875rem;
  color: var(--text-muted);
  line-height: 1.5;
  margin-bottom: 1rem;
}

.privacy-banner .privacy-banner-link {
  color: var(--brand-green);
  text-decoration: underline;
}

.privacy-banner .privacy-banner-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
}

@keyframes slideUp {
  from {
    transform: translateY(100%);
  }

  to {
    transform: translateY(0);
  }
}

/* ==========================================================================
   Flash Messages
   ========================================================================== */
.flash-messages {
  position: fixed;
  top: calc(var(--navbar-height) + 1rem);
  right: 1rem;
  z-index: 2500;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  width: min(380px, calc(100vw - 2rem));
}

.flash {
  padding: 1rem 1.25rem;
  border-radius: var(--radius-md);
  color: white;
  box-shadow: var(--shadow-lg);
  font-size: 0.9rem;
  font-weight: 500;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.flash-notice {
  background-color: var(--brand-green);
}

.flash-alert {
  background-color: var(--danger-color);
}

.flash-success {
  background-color: var(--success-color);
}


/* ==========================================================================
   Responsive Layout
   ========================================================================== */
@media (max-width: 768px) {
  h4 {
    font-size: 1.1rem;
  }

  .container {
    padding-left: 1rem;
    padding-right: 1rem;
    padding-top: 1.5rem;
    padding-bottom: 2rem;
  }

  .surface-box {
    padding: 1.25rem;
    border-radius: var(--radius-md);
  }

  .flash-messages {
    left: 1rem;
    right: 1rem;
    max-width: none;
  }
}

@media (max-width: 640px) {
  .container {
    padding-left: 0.75rem;
    padding-right: 0.75rem;
    padding-top: 1rem;
    padding-bottom: 1.5rem;
  }

  .privacy-banner {
    padding: 1rem;
  }

  .privacy-banner .privacy-banner-actions {
    flex-direction: column;
  }

  .privacy-banner .privacy-banner-actions .button {
    width: 100%;
    justify-content: center;
  }
}

/* ==========================================================================
   Skip Navigation (Accessibility)
   ========================================================================== */
.skip-link {
  position: absolute;
  top: -100%;
  left: 1rem;
  z-index: 9999;
  padding: 0.5rem 1rem;
  background: var(--t-surface-low);
  color: white;
  border-radius: var(--radius-md);
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
}

.skip-link:focus {
  top: 0.5rem;
  color: white;
  text-decoration: none;
}

/* ==========================================================================
   Micro-interactions & Focus
   ========================================================================== */
.turbo-progress-bar {
  background-color: var(--accent-color) !important;
  height: 3px;
}

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

/* ==========================================================================
   Print Styles
   ========================================================================== */
@media print {

  nav,
  footer,
  .privacy-banner,
  .flash-messages,
  .no-print,
  .skip-link,
  button,
  .button {
    display: none !important;
  }

  body {
    background: white !important;
    color: black !important;
    font-size: 12pt;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  .surface-box {
    box-shadow: none !important;
    border: 1px solid #ccc !important;
    break-inside: avoid;
  }

  a {
    color: black;
    text-decoration: underline;
  }

  a[href]::after {
    content: " (" attr(href) ")";
    font-size: 0.8em;
  }

  a[href^="#"]::after,
  a[href^="javascript:"]::after {
    content: "";
  }
}

/* ==========================================================================
   Reduced Motion
   ========================================================================== */
@media (prefers-reduced-motion: reduce) {

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

/* ── Inline Style Cleanup ── */
.admin-nav-email {
  color: var(--text-muted);
  cursor: default;
}

.admin-nav-logout {
  color: var(--danger-color);
}

.admin-flash-wrapper {
  padding-bottom: 0;
}

/* ==========================================================================
   Mobile Overflow Prevention
   ========================================================================== */
@media (max-width: 767px) {

  html,
  body {
    overflow-x: hidden;
    width: 100%;
    max-width: 100vw;
  }
}

/* Page heading normalization (all pages except home) */
.container>h1,
.page-header h1 {
  font-family: var(--font-family-heading);
  font-size: clamp(1.5rem, 3vw, 2rem);
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: -0.025em;
  color: var(--t-on-surface);
  line-height: 1.1;
}
