/* ==========================================================================
   PrepVault — main.css
   Foundation: reset, tokens, typography, layout utilities, header, footer
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. GOOGLE FONTS IMPORT
   -------------------------------------------------------------------------- */
@import url('https://fonts.googleapis.com/css2?family=Nunito:ital,wght@0,400;0,500;0,600;0,700;0,800;0,900;1,400&family=Lato:ital,wght@0,300;0,400;0,700;1,400&family=JetBrains+Mono:wght@400;500&display=swap');


/* --------------------------------------------------------------------------
   2. CSS CUSTOM PROPERTIES
   -------------------------------------------------------------------------- */
:root {
  /* --- Primary Palette --- */
  --accent:       #C4714A;   /* warm terracotta — primary CTAs */
  --accent-dark:  #A55A35;
  --accent-light: #E8916C;
  --accent-pale:  #FAE8DE;

  /* --- Secondary Palette --- */
  --amber:        #D4892A;   /* warm amber — highlights */
  --amber-pale:   #FDF3E0;
  --sage:         #7A9E7E;   /* soft sage — secondary accent */
  --sage-dark:    #5C8060;
  --sage-pale:    #EAF2EB;
  --blue:         #5B7FA6;   /* dusty blue — links, trust signals */
  --blue-pale:    #E8EFF6;

  /* --- Backgrounds --- */
  --bg:           #FFF8F0;   /* warm cream — page background */
  --panel:        #FFFDF9;   /* warm white — cards, header */
  --panel-2:      #F5EDE0;   /* light sand — inputs, sidebar, footer */
  --panel-3:      #EDE0CF;   /* warm sand — deeper surfaces */

  /* --- Borders --- */
  --border:       #E8D8C8;
  --border-light: #F0E4D6;

  /* --- Text --- */
  --text:         #3D2E22;   /* warm dark brown — primary text */
  --text-muted:   #7A6658;   /* medium brown — secondary text */
  --text-dim:     #A89585;   /* light brown — placeholders, captions */

  /* --- Semantic Colors --- */
  --success:      #5C9E6B;
  --warning:      #D4892A;
  --danger:       #C4524A;
  --info:         #5B7FA6;

  /* --- Legacy alias for contrast needs --- */
  --black:        #3D2E22;

  /* --- Typography --- */
  --font-heading: 'Nunito', 'Poppins', system-ui, sans-serif;
  --font-body:    'Lato', system-ui, sans-serif;
  --font-mono:    'JetBrains Mono', 'Fira Code', monospace;

  /* --- Shape & Shadow --- */
  --radius:    10px;
  --radius-lg: 20px;
  --shadow:    0 4px 24px rgba(61, 46, 34, 0.10);
  --shadow-lg: 0 8px 48px rgba(61, 46, 34, 0.16);
  --shadow-sm: 0 2px 8px  rgba(61, 46, 34, 0.07);

  /* --- Motion --- */
  --transition: 200ms ease;

  /* --- Layout --- */
  --max-width:    1280px;
  --header-height: 68px;

  /* --- Spacing Scale (multiples of 4px) --- */
  --space-1:  4px;
  --space-2:  8px;
  --space-3:  12px;
  --space-4:  16px;
  --space-5:  20px;
  --space-6:  24px;
  --space-7:  28px;
  --space-8:  32px;
  --space-9:  36px;
  --space-10: 40px;

  /* --- Z-Index Scale --- */
  --z-header: 100;
  --z-modal:  200;
  --z-toast:  300;

  /* --- Responsive Breakpoints --- */
  --bp-sm: 640px;
  --bp-md: 768px;
  --bp-lg: 1024px;
  --bp-xl: 1280px;
}


/* --------------------------------------------------------------------------
   3. CSS RESET
   -------------------------------------------------------------------------- */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

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

body {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

img,
picture,
video,
canvas,
svg {
  display: block;
  max-width: 100%;
}

input,
button,
textarea,
select {
  font: inherit;
  color: inherit;
  background: none;
  border: none;
}

button {
  cursor: pointer;
  line-height: 1;
}

p,
h1,
h2,
h3,
h4,
h5,
h6 {
  overflow-wrap: break-word;
}

ol,
ul {
  list-style: none;
}

table {
  border-collapse: collapse;
  border-spacing: 0;
}

fieldset {
  border: none;
}

hr {
  border: none;
  border-top: 1px solid var(--border);
}

/* --------------------------------------------------------------------------
   4. BASE TYPOGRAPHY
   -------------------------------------------------------------------------- */
html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-body);
  background-color: var(--bg);
  color: var(--text);
  line-height: 1.75;
  min-height: 100vh;
}

h1,
h2,
h3,
h4,
h5,
h6 {
  font-family: var(--font-heading);
  letter-spacing: -0.01em;
  line-height: 1.2;
  color: var(--text);
  font-weight: 800;
}

h1 { font-size: clamp(2.2rem, 5vw, 3.6rem); font-weight: 900; }
h2 { font-size: clamp(1.6rem, 3vw, 2.4rem); font-weight: 800; }
h3 { font-size: 1.5rem; font-weight: 700; }
h4 { font-size: 1.25rem; font-weight: 700; }
h5 { font-size: 1.1rem;  font-weight: 600; }
h6 { font-size: 1rem;    font-weight: 600; }

p {
  max-width: 70ch;
}

a {
  color: var(--blue);
  text-decoration: none;
}

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

code,
kbd,
samp {
  font-family: var(--font-mono);
  background: var(--panel-2);
  padding: 0.15em 0.4em;
  border-radius: var(--radius);
  font-size: 0.875em;
}

pre {
  font-family: var(--font-mono);
  background: var(--panel-2);
  padding: 1rem 1.25rem;
  border-radius: var(--radius);
  overflow-x: auto;
  line-height: 1.6;
}

pre code {
  background: none;
  padding: 0;
  border-radius: 0;
  font-size: 0.9rem;
}

strong,
b {
  font-weight: 700;
}

em,
i {
  font-style: italic;
}

small {
  font-size: 0.875rem;
  color: var(--text-muted);
}

blockquote {
  border-left: 4px solid var(--accent-pale);
  border-left-color: var(--accent);
  padding-left: 1.25rem;
  color: var(--text-muted);
  font-style: italic;
}

abbr[title] {
  text-decoration: underline dotted;
  cursor: help;
}


/* --------------------------------------------------------------------------
   5. LAYOUT UTILITIES
   -------------------------------------------------------------------------- */

/* Container */
.container {
  max-width: var(--max-width);
  margin-inline: auto;
  padding-inline: 1rem;
}

.container--narrow {
  max-width: 800px;
  margin-inline: auto;
  padding-inline: 1rem;
}

@media (min-width: 640px) {
  .container,
  .container--narrow {
    padding-inline: 1.5rem;
  }
}

/* Flex Utilities */
.flex         { display: flex; gap: 1rem; }
.flex-col     { flex-direction: column; }
.flex-center  { align-items: center; justify-content: center; }
.flex-between { justify-content: space-between; align-items: center; }
.flex-wrap    { flex-wrap: wrap; }
.flex-1       { flex: 1; }
.flex-shrink-0 { flex-shrink: 0; }

/* Grid Utilities */
.grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
}

.grid--tight {
  gap: 1rem;
}

@media (min-width: 640px) {
  .grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 768px) {
  .grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (min-width: 1024px) {
  .grid {
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  }
}

/* Screen-reader Only (visually hidden but accessible) */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

/* Text Color Utilities */
.text-accent   { color: var(--accent); }
.text-muted    { color: var(--text-muted); }
.text-dim      { color: var(--text-dim); }
.text-success  { color: var(--success); }
.text-warning  { color: var(--warning); }
.text-danger   { color: var(--danger); }
.text-info     { color: var(--info); }
.text-center   { text-align: center; }
.text-right    { text-align: right; }

/* Margin Utilities */
.mt-1 { margin-top: var(--space-1); }
.mt-2 { margin-top: var(--space-2); }
.mt-3 { margin-top: var(--space-3); }
.mt-4 { margin-top: var(--space-4); }
.mt-5 { margin-top: var(--space-5); }
.mt-6 { margin-top: var(--space-6); }

.mb-1 { margin-bottom: var(--space-1); }
.mb-2 { margin-bottom: var(--space-2); }
.mb-3 { margin-bottom: var(--space-3); }
.mb-4 { margin-bottom: var(--space-4); }
.mb-5 { margin-bottom: var(--space-5); }
.mb-6 { margin-bottom: var(--space-6); }

/* Padding Utilities */
.p-1 { padding: var(--space-1); }
.p-2 { padding: var(--space-2); }
.p-3 { padding: var(--space-3); }
.p-4 { padding: var(--space-4); }

/* Display Utilities */
.hidden       { display: none; }
.block        { display: block; }
.inline-block { display: inline-block; }
.inline-flex  { display: inline-flex; }

/* Print-only — hidden by default */
.print-only {
  display: none;
}

/* Width Utilities */
.w-full  { width: 100%; }
.h-full  { height: 100%; }


/* --------------------------------------------------------------------------
   6. SKIP LINK (Accessibility)
   -------------------------------------------------------------------------- */
.skip-link {
  position: absolute;
  top: -100%;
  left: 1rem;
  background: var(--accent);
  color: white;
  padding: 0.5rem 1rem;
  border-radius: var(--radius);
  font-weight: 700;
  z-index: var(--z-toast);
  transition: top 0.1s;
  text-decoration: none;
}

.skip-link:focus {
  top: 1rem;
}


/* --------------------------------------------------------------------------
   7. SITE HEADER
   -------------------------------------------------------------------------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: var(--z-header);
  background: var(--panel);
  border-bottom: 1px solid var(--border);
  height: var(--header-height);
  box-shadow: var(--shadow-sm);
}

.site-header__inner {
  max-width: var(--max-width);
  margin-inline: auto;
  padding-inline: 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 100%;
  gap: 1.5rem;
}

/* Logo */
.site-logo {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
  flex-shrink: 0;
}

.site-logo:hover {
  text-decoration: none;
}

.site-logo__mark {
  width: 38px;
  height: 38px;
  background: var(--accent);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-heading);
  font-size: 1rem;
  font-weight: 900;
  color: white;
  flex-shrink: 0;
  line-height: 1;
  letter-spacing: 0;
  user-select: none;
}

.site-logo__text {
  display: flex;
  flex-direction: column;
  gap: 0;
  line-height: 1;
}

.site-logo__name {
  font-family: var(--font-heading);
  font-size: 1.5rem;
  font-weight: 900;
  color: var(--text);
  letter-spacing: -0.01em;
  line-height: 1;
}

.site-logo__tagline {
  font-size: 0.7rem;
  color: var(--text-muted);
  font-family: var(--font-body);
  font-weight: 400;
  line-height: 1.3;
  letter-spacing: 0;
}

/* Header Navigation */
.header-nav {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  margin-inline: auto 0;
}

.header-nav__link {
  color: var(--text-muted);
  text-decoration: none;
  padding: 0.45rem 0.875rem;
  border-radius: 100px;
  font-size: 0.9rem;
  font-weight: 600;
  transition: color var(--transition), background-color var(--transition);
  white-space: nowrap;
}

.header-nav__link:hover {
  color: var(--accent);
  background-color: var(--accent-pale);
  text-decoration: none;
}

.header-nav__link--active {
  color: var(--accent);
  background-color: var(--accent-pale);
}

.header-nav__link--active:hover {
  color: var(--accent-dark);
}

/* Hide text nav links on mobile — show only the logo */
@media (max-width: 767px) {
  .header-nav__link {
    display: none;
  }

  /* Leave space for a hamburger button via a placeholder gap */
  .header-nav--mobile-space {
    width: 40px;
  }
}

@media (min-width: 768px) {
  .header-nav__link {
    display: inline-flex;
  }
}

/* Status Badge */
.status-badge {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.75rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
  white-space: nowrap;
  flex-shrink: 0;
}

.status-badge__dot {
  width: 6px;
  height: 6px;
  background: var(--success);
  border-radius: 50%;
  flex-shrink: 0;
  animation: pulse 2s infinite;
}

.status-badge__dot--offline {
  background: var(--warning);
}

.status-badge__dot--error {
  background: var(--danger);
}

/* Icon Button (header controls) */
.icon-btn {
  background: none;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 0.4rem;
  cursor: pointer;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color var(--transition), border-color var(--transition), background-color var(--transition);
  line-height: 1;
}

.icon-btn:hover {
  color: var(--accent);
  border-color: var(--accent);
  background-color: var(--accent-pale);
}


/* --------------------------------------------------------------------------
   8. SITE FOOTER
   -------------------------------------------------------------------------- */
.site-footer {
  background: var(--panel-2);
  border-top: 1px solid var(--border);
  padding: 3.5rem 0 1.5rem;
  margin-top: 5rem;
}

.site-footer__grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2rem;
}

@media (min-width: 640px) {
  .site-footer__grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 1024px) {
  .site-footer__grid {
    grid-template-columns: 2fr 1fr 1fr 1fr;
  }
}

.site-footer__brand {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.site-footer__brand-desc {
  font-size: 0.9rem;
  color: var(--text-muted);
  line-height: 1.7;
  max-width: 30ch;
}

.site-footer__social {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.site-footer__heading {
  font-family: var(--font-body);
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-dim);
  margin-bottom: 1rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.site-footer__links {
  list-style: none;
  padding: 0;
  margin: 0;
}

.site-footer__links li {
  margin-bottom: 0.625rem;
}

.site-footer__links a {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  transition: color var(--transition);
}

.site-footer__links a:hover {
  color: var(--accent);
  text-decoration: none;
}

.site-footer__bottom {
  border-top: 1px solid var(--border);
  margin-top: 2.5rem;
  padding-top: 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
  font-size: 0.8rem;
  color: var(--text-dim);
}

.site-footer__legal {
  font-size: 0.75rem;
  color: var(--text-dim);
}


/* --------------------------------------------------------------------------
   9. OFFLINE BANNER
   -------------------------------------------------------------------------- */
.offline-banner {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--warning);
  color: white;
  padding: 0.75rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-weight: 700;
  font-size: 0.9rem;
  z-index: var(--z-toast);
  transform: translateY(100%);
  transition: transform 0.3s ease;
}

.offline-banner--visible {
  transform: translateY(0);
}

.offline-banner__dismiss {
  background: none;
  border: none;
  cursor: pointer;
  color: white;
  font-size: 1.1rem;
  opacity: 0.8;
  padding: 0.25rem;
  line-height: 1;
}

.offline-banner__dismiss:hover {
  opacity: 1;
}


/* --------------------------------------------------------------------------
   10. LARGE TEXT MODE
   -------------------------------------------------------------------------- */
html.large-text {
  font-size: 120%;
  /* All rem-based sizes scale automatically with this root font-size change */
}


/* --------------------------------------------------------------------------
   11. KEYFRAME ANIMATIONS
   -------------------------------------------------------------------------- */

/* Pulse — used for status dots */
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.4; }
}

/* FadeIn — modals, toasts, overlays */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* SlideIn — drawers, side panels */
@keyframes slideIn {
  from { transform: translateX(-100%); }
  to   { transform: translateX(0); }
}

/* Spin — loading spinners */
@keyframes spin {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

/* Shimmer — skeleton screens (defined here for global use) */
@keyframes shimmer {
  from { background-position: 200% 0; }
  to   { background-position: -200% 0; }
}


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


/* --------------------------------------------------------------------------
   13. FOCUS VISIBLE (Accessibility)
   -------------------------------------------------------------------------- */

/* Remove the browser default on regular focus */
*:focus {
  outline: none;
}

/* Apply a strong visible ring only on keyboard focus */
*:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Ensure interactive elements within panels also get the ring */
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
[tabindex]:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}


/* --------------------------------------------------------------------------
   14. SELECTION STYLING
   -------------------------------------------------------------------------- */
::selection {
  background-color: var(--accent-pale);
  color: var(--accent-dark);
}

::-moz-selection {
  background-color: var(--accent-pale);
  color: var(--accent-dark);
}


/* --------------------------------------------------------------------------
   15. SCROLLBAR STYLING (optional, Webkit only)
   -------------------------------------------------------------------------- */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--bg);
}

::-webkit-scrollbar-thumb {
  background: var(--panel-3);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--border);
}
