/* ==========================================================================
   Clay Lens Lab — Main Design System & Layout Tokens
   ========================================================================== */

:root {
  /* Color Palette — Precision Optical Lab & Clay Shooting Theme */
  --color-bg-base: #f0f4f8;
  --color-bg-surface: #ffffff;
  --color-bg-surface-elevated: #ffffff;
  --color-bg-alt: #f8fafc;
  --color-bg-subtle: #edf2f7;

  /* Header / Dark Ballistic Accents */
  --color-brand-midnight: #0c1626;
  --color-brand-navy: #15253e;
  --color-brand-steel: #243b5e;
  --color-brand-border: #2d476f;

  /* Clay Blaze Orange (Fluorescent Target Accent) */
  --color-clay-orange: #ea580c;
  --color-clay-orange-hover: #c2410c;
  --color-clay-orange-glow: rgba(234, 88, 12, 0.18);
  --color-clay-amber: #f59e0b;

  /* Typography Colors */
  --color-text-main: #0f172a;
  --color-text-muted: #475569;
  --color-text-subtle: #64748b;
  --color-text-inverse: #f8fafc;
  --color-text-inverse-muted: #cbd5e1;

  /* Borders & Dividers */
  --color-border-light: #e2e8f0;
  --color-border-focus: #3b82f6;

  /* Score Tier Colors */
  --color-tier-high-bg: #ecfdf5;
  --color-tier-high-text: #065f46;
  --color-tier-high-border: #a7f3d0;

  --color-tier-mid-bg: #fffbeb;
  --color-tier-mid-text: #92400e;
  --color-tier-mid-border: #fde68a;

  --color-tier-low-bg: #f1f5f9;
  --color-tier-low-text: #475569;
  --color-tier-low-border: #cbd5e1;

  /* Typography Hierarchy */
  --font-family-base: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --font-family-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;

  /* Elevation Shadows */
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(15, 23, 42, 0.08), 0 2px 4px -2px rgba(15, 23, 42, 0.06);
  --shadow-lg: 0 10px 15px -3px rgba(15, 23, 42, 0.08), 0 4px 6px -4px rgba(15, 23, 42, 0.04);
  --shadow-xl: 0 20px 25px -5px rgba(15, 23, 42, 0.1), 0 8px 10px -6px rgba(15, 23, 42, 0.06);
  --shadow-card: 0 2px 8px rgba(15, 23, 42, 0.04), 0 1px 2px rgba(15, 23, 42, 0.03);

  /* Border Radii */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-full: 9999px;

  /* Transitions */
  --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-normal: 250ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* ==========================================================================
   CSS Resets & Foundation
   ========================================================================== */
*, *::before, *::after {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  font-family: var(--font-family-base);
  font-size: 14px;
  line-height: 1.5;
  color: var(--color-text-main);
  background-color: var(--color-bg-base);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
  max-width: 100%;
  width: 100%;
}

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

a {
  color: #2563eb;
  text-decoration: none;
  transition: color var(--transition-fast);
}

a:hover {
  color: #1d4ed8;
  text-decoration: underline;
}

/* ==========================================================================
   Structural Layout Containers
   ========================================================================== */
.container {
  max-width: 1360px;
  margin-left: auto;
  margin-right: auto;
  padding-left: 24px;
  padding-right: 24px;
}

/* ==========================================================================
   Top Header (Enthusiast Precision Optics Banner)
   ========================================================================== */
.app-header {
  background: linear-gradient(135deg, var(--color-brand-midnight) 0%, var(--color-brand-navy) 60%, var(--color-brand-steel) 100%);
  color: var(--color-text-inverse);
  padding: 32px 0 28px;
  border-bottom: 1px solid var(--color-brand-border);
  box-shadow: var(--shadow-md);
  position: relative;
  overflow: hidden;
}

.app-header::after {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  width: 480px;
  height: 100%;
  background: radial-gradient(circle at 80% 20%, rgba(234, 88, 12, 0.12) 0%, transparent 70%);
  pointer-events: none;
}

.header-inner {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 24px;
  position: relative;
  z-index: 1;
}

.header-branding {
  max-width: 780px;
}

.brand-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  text-transform: uppercase;
  letter-spacing: 1.8px;
  font-size: 11px;
  font-weight: 700;
  color: #93c5fd;
  margin-bottom: 8px;
  flex-wrap: wrap;
}

.brand-sponsor {
  color: #fdba74;
  font-weight: 800;
}

.brand-sep {
  opacity: 0.5;
}

.eyebrow-pill {
  background: rgba(234, 88, 12, 0.25);
  color: #fed7aa;
  border: 1px solid rgba(234, 88, 12, 0.4);
  padding: 2px 8px;
  border-radius: var(--radius-full);
  font-size: 10px;
  letter-spacing: 1px;
}

.app-title {
  margin: 0 0 10px;
  font-size: clamp(26px, 3.5vw, 36px);
  font-weight: 800;
  letter-spacing: -0.75px;
  line-height: 1.15;
}

.app-title .title-accent {
  color: #fdba74;
}

.app-description {
  margin: 0;
  color: var(--color-text-inverse-muted);
  font-size: 14px;
  line-height: 1.6;
}

.header-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: center;
}

.header-disclaimer-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.14);
  padding: 8px 14px;
  border-radius: var(--radius-md);
  color: #e2e8f0;
  font-size: 12px;
  backdrop-filter: blur(8px);
}

/* ==========================================================================
   Panel Container
   ========================================================================== */
.main-content {
  padding-top: 24px;
  padding-bottom: 60px;
}

.panel {
  background: var(--color-bg-surface);
  border: 1px solid var(--color-border-light);
  border-radius: var(--radius-lg);
  padding: 24px;
  margin-bottom: 24px;
  box-shadow: var(--shadow-card);
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}

.panel-title {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.3px;
  color: var(--color-text-main);
  display: flex;
  align-items: center;
  gap: 10px;
}

.panel-title .icon-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  background: var(--color-bg-subtle);
  border-radius: var(--radius-sm);
  font-size: 14px;
}

.panel-subtitle {
  margin: 4px 0 0;
  font-size: 13px;
  color: var(--color-text-muted);
}

/* ==========================================================================
   Buttons
   ========================================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  line-height: 1;
  padding: 9px 16px;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
}

.btn-primary {
  background: var(--color-clay-orange);
  color: #ffffff;
  box-shadow: 0 1px 2px rgba(234, 88, 12, 0.3);
}

.btn-primary:hover {
  background: var(--color-clay-orange-hover);
  box-shadow: 0 2px 6px rgba(234, 88, 12, 0.4);
}

.btn-secondary {
  background: #ffffff;
  color: var(--color-text-main);
  border-color: var(--color-border-light);
  box-shadow: var(--shadow-sm);
}

.btn-secondary:hover {
  background: var(--color-bg-subtle);
  border-color: #cbd5e1;
}

.btn-ghost {
  background: transparent;
  color: var(--color-text-muted);
}

.btn-ghost:hover {
  background: var(--color-bg-subtle);
  color: var(--color-text-main);
}

.btn-sm {
  padding: 6px 12px;
  font-size: 12px;
  border-radius: var(--radius-sm);
}

.btn.active {
  background: #1e3a8a;
  color: #ffffff;
  border-color: #1e3a8a;
  box-shadow: 0 1px 3px rgba(30, 58, 138, 0.3);
}

/* ==========================================================================
   Footer
   ========================================================================== */
.app-footer {
  border-top: 1px solid var(--color-border-light);
  background: #ffffff;
  padding: 36px 0 48px;
  font-size: 13px;
  color: var(--color-text-muted);
}

.footer-inner {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 32px;
}

.footer-brand-line {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.footer-sponsor-tag {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--color-clay-orange);
  background: rgba(234, 88, 12, 0.08);
  border: 1px solid rgba(234, 88, 12, 0.2);
  padding: 2px 8px;
  border-radius: var(--radius-sm);
}

.footer-disclaimer-box {
  background: var(--color-bg-subtle);
  border-left: 4px solid var(--color-clay-orange);
  padding: 14px 18px;
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  margin-top: 14px;
  font-size: 12px;
  line-height: 1.6;
}

/* ==========================================================================
   Full-Screen Fallback Banner (Phase 3)
   ========================================================================== */
.fullscreen-banner {
  background: linear-gradient(90deg, #0c1626 0%, #15253e 50%, #1e3a8a 100%);
  color: #f8fafc;
  padding: 8px 0;
  border-bottom: 2px solid var(--color-clay-orange);
  font-size: 12px;
  position: relative;
  z-index: 10;
}

.fullscreen-banner-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.fullscreen-banner-text {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #e2e8f0;
  font-weight: 500;
}

.fs-badge {
  background: var(--color-clay-orange);
  color: #ffffff;
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  padding: 2px 7px;
  border-radius: var(--radius-sm);
  white-space: nowrap;
}

.btn-open-fullscreen {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.28);
  color: #ffffff;
  padding: 5px 12px;
  border-radius: var(--radius-sm);
  font-weight: 700;
  font-size: 11.5px;
  white-space: nowrap;
  transition: all var(--transition-fast);
  text-decoration: none;
}

.btn-open-fullscreen:hover {
  background: var(--color-clay-orange);
  border-color: var(--color-clay-orange);
  color: #ffffff;
  text-decoration: none;
  box-shadow: 0 2px 6px rgba(234, 88, 12, 0.35);
}

.fs-arrow {
  font-size: 11px;
}

.btn-fullscreen-launch {
  white-space: nowrap;
}

/* Standalone default: banner is discreet, but stays available on mobile */
@media (min-width: 769px) {
  body:not(.is-embedded-body) .fullscreen-banner {
    display: none;
  }
}

/* ==========================================================================
   Embedded iframe Optimizations (When nested inside Squarespace)
   ========================================================================== */
html.is-embedded {
  background-color: transparent;
  overflow-y: visible;
}

html.is-embedded body {
  background-color: var(--color-bg-base);
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
}

html.is-embedded .fullscreen-banner {
  display: block !important;
}

html.is-embedded .app-header {
  padding-top: 18px;
  padding-bottom: 16px;
}

html.is-embedded .main-content {
  padding-top: 12px;
  padding-bottom: 24px;
}

/* Address narrow Squarespace content area by eliminating redundant double gutters */
html.is-embedded .container {
  padding-left: 12px;
  padding-right: 12px;
  max-width: 100%;
}

@media (max-width: 768px) {
  html.is-embedded .container {
    padding-left: 6px;
    padding-right: 6px;
  }
  html.is-embedded .panel {
    padding: 12px 10px;
    margin-bottom: 12px;
  }
}

@media (max-width: 480px) {
  html.is-embedded .container {
    padding-left: 2px;
    padding-right: 2px;
  }
  html.is-embedded .panel {
    padding: 10px 8px;
    margin-bottom: 10px;
    border-radius: var(--radius-sm);
  }
}

/* ==========================================================================
   Responsive Breakpoints & Touch Target Scaling
   ========================================================================== */
@media (max-width: 900px) {
  .header-inner {
    flex-direction: column;
    align-items: stretch;
    gap: 16px;
  }
  .footer-inner {
    grid-template-columns: 1fr;
    gap: 20px;
  }
}

@media (max-width: 768px) {
  .desktop-only-text {
    display: none;
  }
  .app-title {
    font-size: 26px;
  }
  .container {
    padding-left: 14px;
    padding-right: 14px;
  }
  .panel {
    padding: 16px 14px;
    margin-bottom: 16px;
  }
}

@media (max-width: 430px) {
  /* iPhone 14/15 Pro Max & Plus */
  .container {
    padding-left: 10px;
    padding-right: 10px;
  }
  .panel {
    padding: 12px 10px;
    margin-bottom: 12px;
  }
  .app-title {
    font-size: 24px;
  }
  .header-actions {
    flex-direction: column;
    align-items: stretch;
  }
  .header-actions .btn {
    width: 100%;
    justify-content: center;
  }
}

@media (max-width: 390px) {
  /* iPhone 12/13/14/15 Standard */
  .container {
    padding-left: 8px;
    padding-right: 8px;
  }
  .panel {
    padding: 12px 8px;
  }
  .app-title {
    font-size: 22px;
  }
  .fullscreen-banner-inner {
    flex-direction: column;
    align-items: stretch;
    text-align: center;
    gap: 6px;
  }
  .btn-open-fullscreen {
    justify-content: center;
  }
}

@media (max-width: 375px) {
  /* iPhone SE 2nd/3rd gen */
  .container {
    padding-left: 8px;
    padding-right: 8px;
  }
  .panel {
    padding: 10px 8px;
  }
  .app-title {
    font-size: 21px;
  }
}

@media (max-width: 320px) {
  /* iPhone SE 1st gen */
  .container {
    padding-left: 6px;
    padding-right: 6px;
  }
  .panel {
    padding: 10px 6px;
  }
  .panel-title {
    font-size: 15px;
  }
  .app-title {
    font-size: 19px;
  }
}
