/* ==========================================================================
   CyFun Tool - Base Styles (Reset, Typography, Global)
   ========================================================================== */

/* --- Font Faces --- */
@font-face {
  font-family: 'Montserrat';
  src: url('../fonts/montserrat-400-latin.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Montserrat';
  src: url('../fonts/montserrat-600-latin.woff2') format('woff2');
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Montserrat';
  src: url('../fonts/montserrat-700-latin.woff2') format('woff2');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Mulish';
  src: url('../fonts/mulish-400-latin.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Mulish';
  src: url('../fonts/mulish-700-latin.woff2') format('woff2');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

/* --- Reset --- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

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

body {
  font-family: var(--font-body);
  font-size: var(--text-base);
  font-weight: var(--weight-normal);
  line-height: var(--line-height);
  color: var(--color-text);
  background-color: var(--color-bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow: hidden; /* app manages its own scrolling */
  height: 100vh;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  font-weight: var(--weight-semibold);
  line-height: var(--line-height-tight);
  color: var(--color-dark);
}

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

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

button {
  font-family: var(--font-body);
  cursor: pointer;
  border: none;
  background: none;
  font-size: inherit;
}

input, select, textarea {
  font-family: var(--font-body);
  font-size: var(--text-base);
}

table {
  border-collapse: collapse;
  width: 100%;
}

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

/* --- Skip Link (Accessibility) --- */
.skip-link {
  position: absolute;
  top: -40px;
  left: 0;
  background: var(--color-primary);
  color: #fff;
  padding: var(--space-sm) var(--space-lg);
  z-index: 1000;
  transition: top 0.2s;
}
.skip-link:focus {
  top: 0;
}

/* --- Utility Classes --- */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

.text-muted { color: var(--color-text-muted); }
.text-primary { color: var(--color-primary); }
.text-danger { color: var(--color-danger); }
.text-warning { color: var(--color-warning); }
.text-success { color: var(--color-success); }
.text-info { color: var(--color-info); }

.font-semibold { font-weight: var(--weight-semibold); }
.font-bold { font-weight: var(--weight-bold); }
.text-sm { font-size: var(--text-sm); }
.text-xs { font-size: var(--text-xs); }

.hidden { display: none !important; }
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-sm { gap: var(--space-sm); }
.gap-md { gap: var(--space-md); }
.gap-lg { gap: var(--space-lg); }

/* --- Focus Styles (Keyboard Navigation) --- */
:focus-visible {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

button:focus:not(:focus-visible),
a:focus:not(:focus-visible) {
  outline: none;
}

/* --- Loading Skeleton --- */
.skeleton-loading { height: 100vh; background: #fff; overflow: hidden; }
.skeleton-header { height: 72px; background: #111; }
.skeleton-body { display: flex; height: calc(100vh - 72px); }
.skeleton-sidebar { width: 240px; background: #1a1a1a; flex-shrink: 0; }
.skeleton-main { flex: 1; padding: 24px; }
.skeleton-hero { background: linear-gradient(135deg, #111 0%, #1a2e0a 60%, #0d2606 100%); border-radius: 8px; padding: 40px; margin-bottom: 24px; }
.skeleton-line { height: 16px; background: rgba(255,255,255,0.1); border-radius: 4px; margin-bottom: 12px; }
.skeleton-line--lg { width: 60%; height: 24px; }
.skeleton-line--md { width: 45%; }
.skeleton-line--sm { width: 30%; }
.skeleton-stats { display: flex; gap: 16px; margin-top: 20px; }
.skeleton-stat { flex: 1; height: 40px; background: rgba(255,255,255,0.05); border-radius: 4px; }
.skeleton-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.skeleton-card { height: 120px; background: #f5f5f5; border-radius: 8px; border: 1px solid #eee; }

@keyframes skeleton-pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.5; } }
.skeleton-loading * { animation: skeleton-pulse 1.5s ease-in-out infinite; }

/* --- Reduced Motion --- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

/* --- Page Transitions --- */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

.main__content > *:first-child {
  animation: fadeIn 0.15s ease-out;
}

/* --- Mobile Notice Overlay --- */
.mobile-notice {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(17, 17, 17, 0.97);
  color: #fff;
  z-index: var(--z-notice);
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 40px;
  font-family: var(--font-body);
}

@media (max-width: 900px) {
  .mobile-notice:not(.mobile-notice--dismissed) {
    display: flex;
  }
}

.mobile-notice--dismissed {
  display: none !important;
}

.mobile-notice__title {
  font-family: var(--font-heading);
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 12px;
}

.mobile-notice__text {
  font-size: 14px;
  color: rgba(255,255,255,0.6);
  max-width: 400px;
  line-height: 1.6;
  margin-bottom: 20px;
}

.mobile-notice__link {
  color: #339911;
  text-decoration: underline;
}

.mobile-notice__dismiss {
  margin-top: 20px;
  padding: 8px 20px;
  background: transparent;
  border: 1px solid rgba(255,255,255,0.3);
  border-radius: 6px;
  color: rgba(255,255,255,0.6);
  font-size: 13px;
  cursor: pointer;
}

.mobile-notice__dismiss:hover {
  border-color: rgba(255,255,255,0.6);
  color: #fff;
}
