/* ============================================
   LifeGrid - Apple-Inspired Dark Theme
   Black & White with Accents
   Ruler-style borders and clean aesthetics
   ============================================ */

/* === CSS Variables === */
:root {
  /* Core Colors - Black & White */
  --black: #000000;
  --white: #FFFFFF;
  --gray-50: #FAFAFA;
  --gray-100: #F5F5F5;
  --gray-200: #E5E5E5;
  --gray-300: #D4D4D4;
  --gray-400: #A3A3A3;
  --gray-500: #737373;
  --gray-600: #525252;
  --gray-700: #404040;
  --gray-800: #262626;
  --gray-900: #171717;
  --gray-950: #0A0A0A;

  /* Accent - can be overridden */
  --accent: #FFFFFF;

  /* Semantic */
  --bg: var(--black);
  --bg-elevated: var(--gray-950);
  --text: var(--white);
  --text-secondary: var(--gray-400);
  --text-muted: var(--gray-600);
  --border: rgba(255, 255, 255, 0.1);
  --border-strong: rgba(255, 255, 255, 0.2);

  /* Typography */
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'SF Pro Display', sans-serif;
  --font-mono: 'SF Mono', 'Monaco', 'Consolas', monospace;

  /* Spacing Scale */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.25rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --space-10: 2.5rem;
  --space-12: 3rem;
  --space-16: 4rem;
  --space-20: 5rem;
  --space-24: 6rem;

  /* Border Radius */
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --radius-2xl: 24px;

  /* Transitions */
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);
  --duration-fast: 150ms;
  --duration-normal: 300ms;
  --duration-slow: 500ms;
}

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

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  overflow-x: hidden;
}

/* === Noise Texture Overlay === */
.noise {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 1000;
  opacity: 0.03;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
}

/* === Navigation === */
.nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  padding: var(--space-4) var(--space-8);
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
}

.nav-content {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav-logo {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  color: var(--white);
  text-decoration: none;
  font-weight: 600;
  font-size: 1.125rem;
  letter-spacing: -0.02em;
}

.nav-logo svg {
  transition: transform var(--duration-normal) var(--ease-out);
}

.nav-logo:hover svg {
  transform: rotate(90deg);
}

.nav-links {
  display: flex;
  gap: var(--space-8);
}

.nav-link {
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 500;
  transition: color var(--duration-fast);
  position: relative;
}

.nav-link::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 0;
  width: 0;
  height: 1px;
  background: var(--white);
  transition: width var(--duration-normal) var(--ease-out);
}

.nav-link:hover {
  color: var(--white);
}

.nav-link:hover::after {
  width: 100%;
}

/* === Hero Section === */
.hero {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: var(--space-16) var(--space-8);
  position: relative;
  overflow: hidden;
}

.hero-content {
  position: relative;
  z-index: 2;
  max-width: 800px;
}

.hero-eyebrow {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.15em;
  margin-bottom: var(--space-6);
  animation: fadeInUp 0.8s var(--ease-out) backwards;
}

.hero-title {
  font-size: clamp(3rem, 10vw, 6rem);
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.04em;
  margin-bottom: var(--space-6);
  animation: fadeInUp 0.8s var(--ease-out) 0.1s backwards;
}

.hero-title-accent {
  background: linear-gradient(135deg, var(--white) 0%, var(--gray-400) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero-subtitle {
  font-size: 1.25rem;
  color: var(--text-secondary);
  max-width: 500px;
  margin: 0 auto var(--space-10);
  animation: fadeInUp 0.8s var(--ease-out) 0.2s backwards;
}

.hero-cta {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-4) var(--space-6);
  background: var(--white);
  color: var(--black);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.9375rem;
  border-radius: var(--radius-xl);
  transition: all var(--duration-normal) var(--ease-out);
  animation: fadeInUp 0.8s var(--ease-out) 0.3s backwards;
}

.hero-cta:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 40px rgba(255, 255, 255, 0.15);
}

.hero-cta svg {
  animation: bounce 2s infinite;
}

/* Hero Animated Grid */
.hero-grid {
  position: absolute;
  bottom: 10%;
  left: 50%;
  transform: translateX(-50%);
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  opacity: 0.15;
}

.grid-cell {
  width: 40px;
  height: 40px;
  border: 1px solid var(--white);
  border-radius: var(--radius-sm);
  animation: cellPulse 3s infinite;
  animation-delay: calc(var(--delay) * 0.2s);
}

.grid-cell.filled {
  background: var(--white);
  animation: cellFill 3s infinite;
  animation-delay: calc(var(--delay) * 0.2s);
}

@keyframes cellPulse {

  0%,
  100% {
    opacity: 0.3;
  }

  50% {
    opacity: 0.8;
  }
}

@keyframes cellFill {

  0%,
  100% {
    opacity: 0.8;
  }

  50% {
    opacity: 0.3;
  }
}

/* === Sections === */
.section {
  padding: var(--space-24) var(--space-8);
  max-width: 1400px;
  margin: 0 auto;
}

.section-header {
  text-align: center;
  margin-bottom: var(--space-16);
}

.section-eyebrow {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.2em;
  margin-bottom: var(--space-4);
}

.section-title {
  font-size: clamp(2rem, 5vw, 3rem);
  font-weight: 700;
  letter-spacing: -0.03em;
}

/* === Type Cards === */
.type-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-6);
}

@media (max-width: 1024px) {
  .type-cards {
    grid-template-columns: 1fr;
    max-width: 500px;
    margin: 0 auto;
  }
}

.type-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  overflow: hidden;
  cursor: pointer;
  transition: all var(--duration-normal) var(--ease-out);
  position: relative;
}

.type-card::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.1) 0%, transparent 50%);
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
}

.type-card:hover {
  border-color: var(--border-strong);
  transform: translateY(-4px);
}

.type-card.selected {
  border-color: var(--white);
  box-shadow: 0 0 0 1px var(--white);
}

.type-card-visual {
  height: 200px;
  background: var(--gray-950);
  display: flex;
  align-items: center;
  justify-content: center;
  border-bottom: 1px solid var(--border);
  position: relative;
  overflow: hidden;
}

/* Year Grid Preview - 15 columns */
.year-grid-preview {
  display: grid;
  grid-template-columns: repeat(15, 1fr);
  gap: 4px;
  padding: var(--space-4);
}

.year-grid-preview .cell {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
}

.year-grid-preview .cell.filled {
  background: var(--white);
}

/* Life Grid Preview */
.life-grid-preview {
  display: grid;
  grid-template-columns: repeat(13, 1fr);
  gap: 2px;
  padding: var(--space-4);
}

.life-grid-preview .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
}

.life-grid-preview .dot.filled {
  background: var(--white);
}

/* Goal Preview */
.goal-preview {
  display: flex;
  align-items: center;
  justify-content: center;
}

.goal-circle {
  width: 120px;
  height: 120px;
  position: relative;
}

.goal-circle svg {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.goal-circle-bg {
  fill: none;
  stroke: rgba(255, 255, 255, 0.1);
  stroke-width: 4;
}

.goal-circle-progress {
  fill: none;
  stroke: var(--white);
  stroke-width: 4;
  stroke-linecap: round;
  stroke-dasharray: 283;
  stroke-dashoffset: 100;
  transition: stroke-dashoffset var(--duration-slow) var(--ease-out);
}

.goal-number {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.goal-days {
  font-size: 2rem;
  font-weight: 700;
  line-height: 1;
}

.goal-label {
  font-size: 0.75rem;
  color: var(--text-secondary);
  margin-top: var(--space-1);
}

/* Type Card Content */
.type-card-content {
  padding: var(--space-6);
}

.type-card-header {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-bottom: var(--space-3);
}

.type-number {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

.type-name {
  font-size: 1.125rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.type-description {
  font-size: 0.875rem;
  color: var(--text-secondary);
  margin-bottom: var(--space-5);
  line-height: 1.5;
}

.type-stats {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  padding: var(--space-4) 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  margin-bottom: var(--space-5);
}

.stat {
  display: flex;
  flex-direction: column;
}

.stat-value {
  font-size: 1.25rem;
  font-weight: 600;
  font-family: var(--font-mono);
}

.stat-label {
  font-size: 0.6875rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.stat-divider {
  width: 1px;
  height: 32px;
  background: var(--border);
}

.type-select-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-4);
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--duration-fast);
}

.type-select-btn:hover {
  background: var(--white);
  color: var(--black);
  border-color: var(--white);
}

.type-card.selected .type-select-btn {
  background: var(--white);
  color: var(--black);
  border-color: var(--white);
}

/* === Customize Section === */
.customize-section {
  border-top: 1px solid var(--border);
  background: linear-gradient(180deg, var(--gray-950) 0%, var(--black) 100%);
}

.customize-container {
  display: grid;
  grid-template-columns: 1fr 1.2fr;
  gap: var(--space-12);
  align-items: start;
}

@media (max-width: 1024px) {
  .customize-container {
    grid-template-columns: 1fr;
  }
}

/* Preview Panel */
.preview-panel {
  position: sticky;
  top: 120px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.device-frame {
  width: 260px;
  height: 530px;
  background: var(--gray-900);
  border-radius: 40px;
  padding: 10px;
  position: relative;
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.1),
    0 40px 80px rgba(0, 0, 0, 0.5),
    inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.device-notch {
  position: absolute;
  top: 10px;
  left: 50%;
  transform: translateX(-50%);
  width: 100px;
  height: 28px;
  background: var(--black);
  border-radius: 0 0 16px 16px;
  z-index: 10;
}

.device-screen {
  width: 100%;
  height: 100%;
  background: var(--black);
  border-radius: 32px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.device-home {
  position: absolute;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  width: 100px;
  height: 4px;
  background: rgba(255, 255, 255, 0.3);
  border-radius: 2px;
}

.preview-placeholder {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.875rem;
}

.preview-hint {
  margin-top: var(--space-4);
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

/* Config Panel */
.config-panel {
  padding: var(--space-6) 0;
}

.config-panel .section-header {
  text-align: left;
  margin-bottom: var(--space-8);
}

.selected-type-indicator {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-4);
  background: var(--gray-900);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  margin-bottom: var(--space-8);
  font-size: 0.875rem;
}

.indicator-label {
  color: var(--text-muted);
}

.indicator-value {
  font-weight: 500;
}

.config-group {
  margin-bottom: var(--space-6);
}

.config-label {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: var(--space-3);
}

.label-text {
  font-size: 0.875rem;
  font-weight: 500;
}

.label-hint {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* Form Elements */
.select-wrapper {
  position: relative;
}

.config-select,
.config-input {
  width: 100%;
  padding: var(--space-3) var(--space-4);
  background: var(--gray-950);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text);
  font-size: 0.9375rem;
  font-family: inherit;
  transition: border-color var(--duration-fast);
  appearance: none;
}

.config-select:focus,
.config-input:focus {
  outline: none;
  border-color: var(--white);
}

.select-arrow {
  position: absolute;
  right: var(--space-4);
  top: 50%;
  transform: translateY(-50%);
  pointer-events: none;
  color: var(--text-muted);
}

/* Color Fields */
.color-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-4);
  margin-bottom: var(--space-4);
}

.color-field {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.color-field-label {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.color-input-wrapper {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-2) var(--space-3);
  background: var(--gray-950);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  cursor: pointer;
}

.color-input {
  width: 32px;
  height: 32px;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  background: transparent;
  padding: 0;
}

.color-input::-webkit-color-swatch-wrapper {
  padding: 0;
}

.color-input::-webkit-color-swatch {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.color-hex {
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  color: var(--text-secondary);
  text-transform: uppercase;
}

.color-presets {
  display: flex;
  gap: var(--space-2);
}

.preset-btn {
  display: flex;
  gap: 2px;
  padding: var(--space-2);
  background: var(--gray-950);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--duration-fast);
}

.preset-btn:hover {
  border-color: var(--white);
}

.preset-btn span {
  width: 16px;
  height: 16px;
  border-radius: 3px;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

/* Device Options */
.device-options {
  display: flex;
  gap: var(--space-3);
}

.device-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-4);
  background: var(--gray-950);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--duration-fast);
}

.device-btn:hover {
  border-color: var(--border-strong);
  color: var(--text);
}

.device-btn.active {
  border-color: var(--white);
  color: var(--white);
  background: rgba(255, 255, 255, 0.05);
}

.device-btn span {
  font-size: 0.75rem;
  font-weight: 500;
}

/* URL Field */
.url-group {
  margin-top: var(--space-8);
  padding-top: var(--space-8);
  border-top: 1px solid var(--border);
}

.url-field {
  display: flex;
  gap: var(--space-2);
}

.url-input {
  flex: 1;
  padding: var(--space-3) var(--space-4);
  background: var(--gray-950);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-family: var(--font-mono);
  font-size: 0.8125rem;
}

.copy-btn {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-5);
  background: var(--white);
  border: none;
  border-radius: var(--radius-md);
  color: var(--black);
  font-weight: 600;
  font-size: 0.875rem;
  cursor: pointer;
  transition: all var(--duration-fast);
}

.copy-btn:hover {
  transform: scale(1.02);
}

.copy-btn:active {
  transform: scale(0.98);
}

/* Hidden State */
.hidden {
  display: none !important;
}

/* === Setup Section === */
.setup-section {
  border-top: 1px solid var(--border);
}

.setup-steps {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  gap: 0;
  max-width: 1000px;
  margin: 0 auto;
}

@media (max-width: 768px) {
  .setup-steps {
    flex-direction: column;
    align-items: center;
  }

  .step-connector {
    width: 1px !important;
    height: 40px !important;
  }
}

.setup-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  flex: 1;
  max-width: 200px;
}

.step-number {
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--white);
  border-radius: 50%;
  font-size: 1.125rem;
  font-weight: 600;
  margin-bottom: var(--space-4);
}

.step-content h3 {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: var(--space-2);
}

.step-content p {
  font-size: 0.875rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

.step-connector {
  width: 60px;
  height: 1px;
  background: var(--border);
  margin-top: 24px;
}

/* === Footer === */
.footer {
  border-top: 1px solid var(--border);
  padding: var(--space-12) var(--space-8);
  text-align: center;
}

.footer-content {
  max-width: 1200px;
  margin: 0 auto;
}

.footer-brand {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  color: var(--white);
  font-weight: 600;
  margin-bottom: var(--space-3);
}

.footer-tagline {
  font-size: 0.875rem;
  color: var(--text-muted);
}

/* === Animations === */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes bounce {

  0%,
  20%,
  50%,
  80%,
  100% {
    transform: translateY(0);
  }

  40% {
    transform: translateY(5px);
  }

  60% {
    transform: translateY(3px);
  }
}

/* Scroll Animations */
.type-card,
.setup-step {
  animation: fadeInUp 0.6s var(--ease-out) backwards;
}

.type-card:nth-child(1) {
  animation-delay: 0.1s;
}

.type-card:nth-child(2) {
  animation-delay: 0.2s;
}

.type-card:nth-child(3) {
  animation-delay: 0.3s;
}

.setup-step:nth-child(1) {
  animation-delay: 0.1s;
}

.setup-step:nth-child(3) {
  animation-delay: 0.2s;
}

.setup-step:nth-child(5) {
  animation-delay: 0.3s;
}

.setup-step:nth-child(7) {
  animation-delay: 0.4s;
}

/* === Scrollbar === */
::-webkit-scrollbar {
  width: 8px;
}

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

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

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

/* === Selection === */
::selection {
  background: rgba(255, 255, 255, 0.2);
}

/* === Responsive === */
@media (max-width: 768px) {
  .nav-links {
    display: none;
  }

  .hero-title {
    font-size: 2.5rem;
  }

  .hero-subtitle {
    font-size: 1rem;
  }

  .customize-container {
    gap: var(--space-8);
  }

  .preview-panel {
    position: relative;
    top: 0;
  }
}