/* ─── THE HUMAN STACK: 90-Day Influence Plan ─────────────────────
   Design System: "The Digital Workshop"
   Anti-hype. High utility. Human-centric.
   ─────────────────────────────────────────────────────────────── */

/* ─── RESET & FOUNDATIONS ────────────────────────────────────── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --canvas: #EAEAEA;
  --surface: #FFFFFF;
  --text-primary: #101216;
  --ui-structure: #3A4252;
  --action: #FF2E63;
  --action-hover: #e0264f;

  --font-headline: 'Helvetica Neue', Helvetica, Arial, sans-serif;
  --font-body: 'Work Sans', sans-serif;

  --shadow-card: 0 2px 8px rgba(0, 0, 0, 0.08);
  --shadow-card-hover: 0 4px 16px rgba(0, 0, 0, 0.12);
  --radius: 4px;

  --sidebar-width: 280px;
}

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

body {
  font-family: var(--font-body);
  color: var(--text-primary);
  background: var(--canvas);
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

/* ─── TYPOGRAPHY ─────────────────────────────────────────────── */
.label {
  font-family: var(--font-headline);
  font-weight: 700;
  font-size: 11px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--ui-structure);
}

.headline {
  font-family: var(--font-headline);
  font-weight: 700;
  font-size: 1.5rem;
  line-height: 1.25;
  color: var(--text-primary);
}

.body-text {
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.6;
  color: var(--text-primary);
}

/* ─── MOBILE HEADER ──────────────────────────────────────────── */
.mobile-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  background: var(--canvas);
  position: sticky;
  top: 0;
  z-index: 100;
}

.mobile-header__logo {
  height: 32px;
  width: auto;
}

.mobile-header__menu-btn {
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.mobile-header__menu-btn span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--text-primary);
  transition: transform 0.2s ease, opacity 0.2s ease;
}

.mobile-header__menu-btn.active span:nth-child(1) {
  transform: rotate(45deg) translate(5px, 5px);
}
.mobile-header__menu-btn.active span:nth-child(2) {
  opacity: 0;
}
.mobile-header__menu-btn.active span:nth-child(3) {
  transform: rotate(-45deg) translate(5px, -5px);
}

/* ─── SIDEBAR ────────────────────────────────────────────────── */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: var(--sidebar-width);
  height: 100%;
  background: var(--text-primary);
  color: #fff;
  padding: 32px 24px;
  z-index: 200;
  transform: translateX(-100%);
  transition: transform 0.3s ease;
  overflow-y: auto;
}

.sidebar.open {
  transform: translateX(0);
}

.sidebar__overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 199;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}

.sidebar__overlay.visible {
  opacity: 1;
  visibility: visible;
}

.sidebar__logo {
  height: 40px;
  width: auto;
  margin-bottom: 8px;
}

.sidebar__title {
  font-family: var(--font-headline);
  font-weight: 700;
  font-size: 14px;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: #fff;
  margin-bottom: 32px;
}

.sidebar__divider {
  height: 1px;
  background: var(--ui-structure);
  margin: 24px 0;
}

/* Phase navigation */
.sidebar__phases {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.sidebar__phase {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-radius: var(--radius);
  cursor: pointer;
  transition: background 0.15s ease;
  position: relative;
  border: none;
  background: none;
  color: rgba(255, 255, 255, 0.6);
  font-family: var(--font-body);
  font-size: 14px;
  width: 100%;
  text-align: left;
}

.sidebar__phase:hover {
  background: rgba(255, 255, 255, 0.05);
}

.sidebar__phase.active {
  color: #fff;
  background: rgba(255, 255, 255, 0.08);
}

.sidebar__phase.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 4px;
  bottom: 4px;
  width: 3px;
  background: var(--action);
  border-radius: 0 2px 2px 0;
}

.sidebar__phase-number {
  font-family: var(--font-headline);
  font-weight: 700;
  font-size: 11px;
  letter-spacing: 1px;
  opacity: 0.5;
}

.sidebar__phase-name {
  font-weight: 600;
}

.sidebar__phase-subtitle {
  font-size: 12px;
  opacity: 0.5;
  margin-top: 2px;
}

/* Progress section */
.sidebar__progress {
  margin-top: 8px;
}

.sidebar__progress-label {
  font-family: var(--font-headline);
  font-weight: 700;
  font-size: 11px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.5);
  margin-bottom: 12px;
}

.sidebar__streak {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  color: rgba(255, 255, 255, 0.8);
  margin-bottom: 16px;
}

.sidebar__streak-icon {
  width: 20px;
  height: 20px;
  stroke: var(--action);
  fill: none;
  stroke-width: 2;
}

.sidebar__streak-count {
  font-family: var(--font-headline);
  font-weight: 700;
  color: #fff;
}

.progress-bar {
  width: 100%;
  height: 4px;
  background: var(--ui-structure);
  border-radius: 2px;
  overflow: hidden;
  margin-bottom: 8px;
}

.progress-bar__fill {
  height: 100%;
  background: var(--action);
  border-radius: 2px;
  transition: width 0.5s ease;
}

.progress-bar__text {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.5);
}

/* Sidebar footer */
.sidebar__footer {
  position: absolute;
  bottom: 24px;
  left: 24px;
  right: 24px;
}

.sidebar__footer a {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.4);
  text-decoration: none;
  transition: color 0.15s ease;
}

.sidebar__footer a:hover {
  color: rgba(255, 255, 255, 0.7);
}

/* ─── MAIN CANVAS ────────────────────────────────────────────── */
.canvas {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px 20px 40px;
  min-height: calc(100vh - 64px);
  min-height: calc(100dvh - 64px);
}

/* ─── DAILY CARD ─────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
  width: 100%;
  max-width: 520px;
  padding: 32px 28px;
  transition: box-shadow 0.2s ease, transform 0.2s ease;
}

.card__phase-label {
  font-family: var(--font-headline);
  font-weight: 700;
  font-size: 11px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--ui-structure);
  margin-bottom: 4px;
}

.card__day-label {
  font-family: var(--font-body);
  font-size: 13px;
  color: var(--ui-structure);
  margin-bottom: 28px;
}

.card__headline {
  font-family: var(--font-headline);
  font-weight: 700;
  font-size: 1.5rem;
  line-height: 1.25;
  color: var(--text-primary);
  margin-bottom: 16px;
}

.card__body {
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.65;
  color: var(--text-primary);
  margin-bottom: 32px;
}

/* Reflection input */
.card__reflection {
  margin-bottom: 28px;
}

.card__reflection-label {
  font-family: var(--font-headline);
  font-weight: 700;
  font-size: 11px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--ui-structure);
  margin-bottom: 8px;
}

.card__reflection-input {
  width: 100%;
  min-height: 80px;
  padding: 12px 14px;
  border: 1px solid var(--ui-structure);
  border-radius: var(--radius);
  font-family: var(--font-body);
  font-size: 0.9375rem;
  line-height: 1.5;
  color: var(--text-primary);
  background: var(--surface);
  resize: vertical;
  transition: border-color 0.15s ease;
}

.card__reflection-input:focus {
  outline: none;
  border: 2px solid var(--text-primary);
  padding: 11px 13px;
}

.card__reflection-input::placeholder {
  color: var(--ui-structure);
  opacity: 0.6;
}

/* Done button */
.card__done-btn {
  width: 100%;
  padding: 14px 24px;
  border: none;
  border-radius: var(--radius);
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.9375rem;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.1s ease;
  background: var(--action);
  color: #fff;
}

.card__done-btn:hover {
  background: var(--action-hover);
}

.card__done-btn:active {
  transform: scale(0.985);
}

.card__done-btn.completed {
  background: none;
  border: 2px solid var(--ui-structure);
  color: var(--ui-structure);
  cursor: default;
}

.card__done-btn.completed:hover {
  background: none;
}

.card__done-btn .checkmark {
  display: none;
}

.card__done-btn.completed .checkmark {
  display: inline;
  margin-right: 6px;
}

/* ─── CARD NAVIGATION ───────────────────────────────────────── */
.card-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  max-width: 520px;
  margin-top: 24px;
  padding: 0 4px;
}

.card-nav__btn {
  background: none;
  border: none;
  font-family: var(--font-body);
  font-size: 13px;
  color: var(--ui-structure);
  cursor: pointer;
  padding: 8px 12px;
  text-decoration: underline;
  text-underline-offset: 3px;
  transition: color 0.15s ease;
}

.card-nav__btn:hover {
  color: var(--text-primary);
}

.card-nav__btn:disabled {
  opacity: 0.3;
  cursor: default;
}

.card-nav__btn:disabled:hover {
  color: var(--ui-structure);
}

.card-nav__today {
  font-family: var(--font-headline);
  font-weight: 700;
  font-size: 11px;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--ui-structure);
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px 12px;
  transition: color 0.15s ease;
}

.card-nav__today:hover {
  color: var(--text-primary);
}

/* ─── PHASE TRANSITION SCREEN ────────────────────────────────── */
.phase-transition {
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 40px 28px;
  width: 100%;
  max-width: 520px;
}

.phase-transition.visible {
  display: flex;
}

.phase-transition__complete-label {
  font-family: var(--font-headline);
  font-weight: 700;
  font-size: 11px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--ui-structure);
  margin-bottom: 24px;
}

.phase-transition__message {
  font-family: var(--font-body);
  font-size: 1.125rem;
  line-height: 1.6;
  color: var(--text-primary);
  margin-bottom: 36px;
  max-width: 360px;
}

.phase-transition__btn {
  padding: 14px 32px;
  background: var(--action);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.9375rem;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  cursor: pointer;
  transition: background 0.15s ease;
}

.phase-transition__btn:hover {
  background: var(--action-hover);
}

/* ─── WELCOME SCREEN ─────────────────────────────────────────── */
.welcome {
  position: fixed;
  inset: 0;
  background: var(--text-primary);
  color: #fff;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 28px;
  text-align: center;
  z-index: 500;
  transition: opacity 0.4s ease, visibility 0.4s ease;
}

.welcome.hidden {
  opacity: 0;
  visibility: hidden;
}

.welcome__logo {
  height: 56px;
  width: auto;
  margin-bottom: 16px;
}

.welcome__title {
  font-family: var(--font-headline);
  font-weight: 700;
  font-size: 1.25rem;
  letter-spacing: 1px;
  text-transform: uppercase;
  margin-bottom: 24px;
}

.welcome__subtitle {
  font-family: var(--font-headline);
  font-weight: 700;
  font-size: 2rem;
  line-height: 1.2;
  margin-bottom: 20px;
}

.welcome__description {
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.65;
  color: rgba(255, 255, 255, 0.7);
  max-width: 380px;
  margin-bottom: 40px;
}

.welcome__start-btn {
  padding: 16px 40px;
  background: var(--action);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 1rem;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.1s ease;
}

.welcome__start-btn:hover {
  background: var(--action-hover);
}

.welcome__start-btn:active {
  transform: scale(0.97);
}

/* ─── INSTALL PROMPT ─────────────────────────────────────────── */
.install-prompt {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--surface);
  border-top: 1px solid var(--ui-structure);
  padding: 16px 20px;
  display: none;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  z-index: 300;
  box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.1);
}

.install-prompt.visible {
  display: flex;
}

.install-prompt__text {
  font-size: 13px;
  line-height: 1.4;
  color: var(--text-primary);
}

.install-prompt__btn {
  padding: 10px 20px;
  background: var(--action);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 13px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
}

.install-prompt__dismiss {
  background: none;
  border: none;
  color: var(--ui-structure);
  cursor: pointer;
  padding: 8px;
  font-size: 18px;
  flex-shrink: 0;
}

/* ─── NOTIFICATION PROMPT ────────────────────────────────────── */
.notification-prompt {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--surface);
  border-top: 1px solid var(--ui-structure);
  padding: 20px;
  display: none;
  flex-direction: column;
  gap: 12px;
  z-index: 300;
  box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.1);
}

.notification-prompt.visible {
  display: flex;
}

.notification-prompt__title {
  font-family: var(--font-headline);
  font-weight: 700;
  font-size: 11px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--ui-structure);
}

.notification-prompt__text {
  font-size: 14px;
  line-height: 1.5;
  color: var(--text-primary);
}

.notification-prompt__actions {
  display: flex;
  gap: 12px;
}

.notification-prompt__enable {
  padding: 10px 20px;
  background: var(--action);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 13px;
  text-transform: uppercase;
  cursor: pointer;
}

.notification-prompt__skip {
  padding: 10px 20px;
  background: none;
  border: 2px solid var(--ui-structure);
  border-radius: var(--radius);
  color: var(--ui-structure);
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 13px;
  text-transform: uppercase;
  cursor: pointer;
}

/* ─── FOOTER ─────────────────────────────────────────────────── */
.app-footer {
  text-align: center;
  padding: 20px;
}

.app-footer__link {
  font-size: 12px;
  color: var(--ui-structure);
  text-decoration: none;
  letter-spacing: 0.5px;
  transition: color 0.15s ease;
}

.app-footer__link:hover {
  color: var(--text-primary);
}

/* ─── COMPLETION ANIMATION ───────────────────────────────────── */
@keyframes pulse-complete {
  0% { transform: scale(1); }
  50% { transform: scale(1.02); }
  100% { transform: scale(1); }
}

.card.just-completed {
  animation: pulse-complete 0.4s ease;
}

/* ─── DESKTOP LAYOUT ─────────────────────────────────────────── */
@media (min-width: 768px) {
  .mobile-header {
    display: none;
  }

  .sidebar {
    transform: translateX(0);
    position: fixed;
  }

  .sidebar__overlay {
    display: none;
  }

  body {
    padding-left: var(--sidebar-width);
  }

  .canvas {
    min-height: 100vh;
    padding: 40px 40px 60px;
  }

  .card {
    padding: 40px 36px;
  }

  .card__headline {
    font-size: 1.75rem;
  }
}

@media (min-width: 1024px) {
  .card {
    padding: 48px 44px;
  }
}

/* ─── PWA STANDALONE MODE ────────────────────────────────────── */
@media (display-mode: standalone) {
  .mobile-header {
    padding-top: env(safe-area-inset-top, 16px);
  }

  .install-prompt {
    display: none !important;
  }
}

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