/* Calory — Base Styles
 * Reset, typography, body. Uses Aakar (display) + Ubuntu Sans (body).
 */

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

body {
  font-family: 'Ubuntu Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 0.9375rem;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

/* Skip to content for keyboard users */
.skip-link {
  position: absolute;
  top: -100%;
  left: 0;
  right: 0;
  background: var(--surface2);
  color: var(--text);
  padding: 10px 16px;
  z-index: 10001;
  font-size: 0.85rem;
  font-weight: 600;
  text-decoration: none;
}

.skip-link:focus {
  top: 0;
}

/* Typography Hierarchy */

h1,
.h1,
[data-display="1"] {
  font-family: 'Aakar', Georgia, 'Times New Roman', serif;
  font-size: 1.75rem;
  font-weight: 700;
  line-height: 1.05;
  letter-spacing: -0.01em;
  color: var(--text);
}

h2,
.h2,
[data-display="2"] {
  font-family: 'Aakar', Georgia, 'Times New Roman', serif;
  font-size: 1.5rem;
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.01em;
  color: var(--text);
}

h3,
.h3,
[data-display="3"] {
  font-family: 'Ubuntu Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 1.05rem;
  font-weight: 600;
  line-height: 1.2;
  color: var(--text);
}

/* Display large number (calorie hero) */
[data-display="hero"] {
  font-family: 'Aakar', Georgia, 'Times New Roman', serif;
  font-size: 2.5rem;
  font-weight: 500;
  line-height: 1.0;
  letter-spacing: -0.02em;
  color: var(--text);
}

[data-display="hero"].accent {
  color: var(--accent);
}

/* Body types */
.text-sub {
  color: var(--text-sub);
  font-size: 0.875rem;
}

.text-muted {
  color: var(--text-muted);
  font-size: 0.75rem;
  line-height: 1.4;
}

/* Labels — uppercase, tracked */
.label {
  font-family: 'Ubuntu Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 0.6875rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}

/* Links */
a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  color: var(--accent2);
}

a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 2px;
}

/* Scrollbar — subtle */
::-webkit-scrollbar {
  width: 4px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 2px;
}

/* Selection */
::selection {
  background: var(--accent-dim);
  color: var(--accent);
}

/* Focus visible — all interactive elements */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

/* Page container */
.page-container {
  max-width: 600px;
  margin: 0 auto;
  padding: 16px;
  padding-bottom: calc(80px + var(--container-pb-extra, 32px));
}

/* Page views */
.page {
  display: none;
}

.page.active {
  display: block;
  animation: pageSlideIn var(--page-transition) var(--ease-out) both;
}

@keyframes pageSlideIn {
  from {
    opacity: 0;
    transform: translateX(8px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* Skeleton loading */
.skeleton {
  border-radius: var(--radius-md);
  background: var(--surface);
  position: relative;
  overflow: hidden;
}

.skeleton::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(255, 255, 255, 0.03) 50%,
    transparent 100%
  );
  animation: shimmer var(--shimmer-speed) infinite;
}

@keyframes shimmer {
  from { transform: translateX(-100%); }
  to { transform: translateX(100%); }
}

.skeleton-bar {
  height: 14px;
  margin-bottom: 10px;
}

.skeleton-bar:last-child {
  margin-bottom: 0;
}

.skeleton-bar.w-lg { width: 100%; }
.skeleton-bar.w-md { width: 75%; }
.skeleton-bar.w-sm { width: 50%; }
.skeleton-bar.w-xs { width: 30%; }

.skeleton-ring {
  width: 130px;
  height: 130px;
  border-radius: 50%;
  border: 7px solid var(--surface);
  position: relative;
  overflow: hidden;
  margin: 0 auto;
}

.skeleton-ring::after {
  content: '';
  position: absolute;
  inset: -50%;
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(255, 255, 255, 0.03) 50%,
    transparent 100%
  );
  animation: shimmer var(--shimmer-speed) infinite;
}

/* Empty state */
.empty-state {
  text-align: center;
  padding: 48px 24px;
}

.empty-state-icon {
  font-size: 2rem;
  margin-bottom: 12px;
  opacity: 0.3;
}

.empty-state-text {
  font-family: 'Aakar', Georgia, 'Times New Roman', serif;
  font-size: 1.1rem;
  font-weight: 500;
  color: var(--text-sub);
  margin-bottom: 16px;
}

.empty-state-cta {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 20px;
  background: var(--accent);
  color: var(--bg);
  font-family: 'Ubuntu Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 0.875rem;
  font-weight: 600;
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-fast) ease;
}

.empty-state-cta:hover {
  background: var(--accent2);
}

.empty-state-cta:active {
  transform: scale(0.97);
}
