/* Rippl demo · self-contained build of the feed, log, and profile.
   Palette and type follow the app's constants/Colors.ts. */

@font-face {
  font-family: "Manrope";
  src: url("assets/fonts/Manrope-400.ttf") format("truetype");
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "Manrope";
  src: url("assets/fonts/Manrope-500.ttf") format("truetype");
  font-weight: 500;
  font-display: swap;
}
@font-face {
  font-family: "Manrope";
  src: url("assets/fonts/Manrope-600.ttf") format("truetype");
  font-weight: 600;
  font-display: swap;
}
@font-face {
  font-family: "Manrope";
  src: url("assets/fonts/Manrope-700.ttf") format("truetype");
  font-weight: 700;
  font-display: swap;
}
@font-face {
  font-family: "Jakarta";
  src: url("assets/fonts/PlusJakarta-700.ttf") format("truetype");
  font-weight: 700;
  font-display: swap;
}
@font-face {
  font-family: "Jakarta";
  src: url("assets/fonts/PlusJakarta-800.ttf") format("truetype");
  font-weight: 800;
  font-display: swap;
}

:root {
  --green-900: #012d1d;
  --green-800: #1b4332;
  --green-600: #126c40;
  --green-500: #1b6b4a;
  --mint: #a1f5bc;
  --green-light: #e8f5ee;
  --white: #ffffff;
  --bg: #fafafa;
  --gray-100: #f9f9f8;
  --gray-200: #e1e3e2;
  --gray-400: #9ca3af;
  --gray-500: #5c625e;
  --gray-600: #414844;
  --gray-900: #191c1c;
  --flame: #ea580c;
  --flame-bg: #fff1e6;
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --ease-spring: cubic-bezier(0.34, 1.4, 0.64, 1);
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  display: grid;
  place-items: center;
  overflow: hidden;
  background: #101816;
  font-family: "Manrope", -apple-system, "Segoe UI", sans-serif;
  color: var(--green-900);
  -webkit-font-smoothing: antialiased;
}

button,
input {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
}

svg {
  display: block;
}

.app {
  position: relative;
  width: min(390px, 100vw);
  height: min(844px, 100dvh);
  overflow: hidden;
  background: var(--bg);
}

.scroll {
  position: absolute;
  inset: 0;
  overflow-x: hidden;
  overflow-y: auto;
  padding-bottom: 112px;
  overscroll-behavior: contain;
  scrollbar-width: none;
}

.scroll::-webkit-scrollbar {
  display: none;
}

.brand {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 24px 0 14px;
}

.brand img {
  width: 24px;
  height: 25px;
  object-fit: contain;
}

.brand span {
  font-family: "Jakarta", sans-serif;
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -0.6px;
  color: var(--green-900);
}

.view {
  padding: 0 16px;
}

.view:not([hidden]) {
  animation: viewIn 200ms var(--ease-out) both;
}

@keyframes viewIn {
  from {
    opacity: 0;
    transform: translateY(5px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

/* ---------- Feed ---------- */

.impact {
  position: relative;
  overflow: hidden;
  margin-top: 4px;
  padding: 25px 22px;
  border-radius: 24px;
  background: var(--green-900);
  color: var(--white);
}

.impact-leaf {
  position: absolute;
  right: -28px;
  bottom: -18px;
  width: 144px;
  height: 150px;
  object-fit: contain;
  opacity: 0.08;
  transform: rotate(-18deg);
  pointer-events: none;
}

.impact-eyebrow {
  margin: 0 0 14px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--mint);
}

.impact-text {
  margin: 0;
  max-width: 270px;
  font-family: "Jakarta", sans-serif;
  font-size: 27px;
  font-weight: 800;
  line-height: 1.18;
  letter-spacing: -0.7px;
}

.impact-text span {
  color: var(--mint);
}

.post {
  margin-top: 14px;
  padding: 16px;
  border: 1px solid #f0f2f0;
  border-radius: 22px;
  background: var(--white);
  box-shadow: 0 1px 2px rgba(1, 45, 29, 0.03);
}

.post-head {
  display: flex;
  align-items: center;
  gap: 10px;
}

.avatar {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  flex: none;
  border-radius: 50%;
  background: var(--green-800);
  color: var(--white);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.who {
  min-width: 0;
}

.who strong {
  display: block;
  font-size: 15px;
  font-weight: 700;
  line-height: 1.2;
}

.who span {
  display: block;
  margin-top: 2px;
  font-size: 12.5px;
  color: var(--gray-500);
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 12px;
}

.tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 26px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 600;
}

.tag svg {
  width: 12px;
  height: 12px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.tag-habit {
  background: var(--green-light);
  color: var(--green-600);
}

.tag-streak {
  background: var(--flame-bg);
  color: var(--flame);
}

.caption {
  margin: 12px 0 0;
  font-size: 14.5px;
  line-height: 1.52;
  color: #1f2937;
}

.post-img {
  display: block;
  width: 100%;
  margin-top: 12px;
  aspect-ratio: 3 / 2;
  object-fit: cover;
  border-radius: 14px;
}

.post-actions {
  display: flex;
  align-items: center;
  gap: 22px;
  margin-top: 13px;
  padding-top: 11px;
  border-top: 1px solid #f0f2f0;
}

.action {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 2px 0;
  border: 0;
  background: transparent;
  color: var(--gray-400);
  font-size: 13px;
  font-weight: 600;
  transition:
    color 140ms var(--ease-out),
    transform 120ms var(--ease-out);
}

.action svg {
  width: 19px;
  height: 19px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.action:active {
  transform: scale(0.94);
}

.action.is-liked {
  color: var(--green-600);
}

.action.is-liked svg {
  fill: currentColor;
}

.action.pop svg {
  animation: pop 260ms var(--ease-spring);
}

@keyframes pop {
  0% {
    transform: scale(1);
  }
  40% {
    transform: scale(1.3);
  }
  100% {
    transform: scale(1);
  }
}

.action:focus-visible,
.tab:focus-visible,
.plus:focus-visible,
.log-btn:focus-visible,
.levelup-btn:focus-visible,
.sheet-close:focus-visible {
  outline: 2px solid var(--green-600);
  outline-offset: 2px;
}

/* ---------- Log ---------- */

.page-title {
  margin: 4px 0 0;
  font-family: "Jakarta", sans-serif;
  font-size: 30px;
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -0.8px;
}

.page-sub {
  margin: 5px 0 20px;
  font-size: 14.5px;
  line-height: 1.5;
  color: var(--gray-500);
}

.habit {
  margin-bottom: 15px;
  padding: 18px;
  border: 1px solid #f0f2f0;
  border-radius: 24px;
  background: var(--white);
}

.habit-top {
  display: flex;
  align-items: center;
  gap: 16px;
}

.ring {
  position: relative;
  width: 108px;
  height: 108px;
  flex: none;
}

.ring svg {
  width: 108px;
  height: 108px;
}

.ring circle {
  fill: none;
  stroke-width: 8;
  stroke-linecap: round;
}

.ring-track {
  stroke: #dde3df;
}

.ring-progress {
  stroke: var(--green-900);
  transform: rotate(-90deg);
  transform-origin: 50% 50%;
  transition: stroke-dashoffset 520ms var(--ease-out);
}

.ring-center {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.ring-center strong {
  font-family: "Jakarta", sans-serif;
  font-size: 30px;
  font-weight: 800;
  letter-spacing: -1px;
}

.ring-center span {
  margin-top: 4px;
  font-size: 12px;
  color: var(--gray-500);
}

.habit-info {
  min-width: 0;
  flex: 1;
}

.habit-cat {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 7px;
  border-radius: 6px;
  background: #f1f3f2;
  color: var(--gray-500);
  font-size: 8.5px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.habit-cat svg {
  width: 10px;
  height: 10px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.habit-info h2 {
  margin: 8px 0 4px;
  font-family: "Jakarta", sans-serif;
  font-size: 19px;
  font-weight: 800;
  line-height: 1.2;
  letter-spacing: -0.4px;
}

.habit-info p {
  display: -webkit-box;
  overflow: hidden;
  margin: 0;
  font-size: 12.5px;
  line-height: 1.45;
  color: var(--gray-500);
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.log-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  height: 48px;
  margin-top: 16px;
  padding: 0 18px;
  border: 0;
  border-radius: 999px;
  background: #e8edea;
  color: var(--green-900);
  font-size: 14.5px;
  font-weight: 700;
  transition:
    background-color 150ms var(--ease-out),
    transform 120ms var(--ease-out);
}

.log-btn svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.log-btn:hover {
  background: #dde6e1;
}

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

.log-btn.is-logged {
  background: var(--green-light);
  color: var(--green-600);
  cursor: default;
}

.log-btn.is-logged:hover {
  background: var(--green-light);
}

/* ---------- Profile ---------- */

.profile {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding-top: 10px;
  text-align: center;
}

.avatar-lg {
  width: 104px;
  height: 104px;
  border: 2px solid var(--green-600);
  background: var(--green-light);
  color: var(--green-900);
  font-family: "Jakarta", sans-serif;
  font-size: 34px;
  font-weight: 800;
  letter-spacing: -1px;
}

.profile h1 {
  margin: 15px 0 9px;
  font-family: "Jakarta", sans-serif;
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -0.6px;
}

.follow {
  display: flex;
  align-items: center;
  gap: 14px;
  font-size: 13.5px;
  color: var(--gray-500);
}

.follow strong {
  margin-right: 4px;
  font-size: 15.5px;
  font-weight: 700;
  color: var(--green-900);
}

.follow i {
  width: 1px;
  height: 20px;
  background: var(--gray-200);
}

.section-title {
  margin: 26px 0 12px;
  font-family: "Jakarta", sans-serif;
  font-size: 21px;
  font-weight: 800;
  text-align: center;
  letter-spacing: -0.5px;
}

.streak-cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.streak-card {
  padding: 18px 12px;
  border-radius: 12px;
  background: #f3f5f4;
  text-align: center;
}

.streak-card strong {
  display: block;
  font-family: "Jakarta", sans-serif;
  font-size: 30px;
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -0.8px;
}

.streak-card span {
  display: block;
  margin-top: 5px;
  font-size: 12.5px;
  color: var(--gray-500);
}

.badges {
  display: flex;
  justify-content: center;
  gap: 26px;
  padding-bottom: 8px;
}

.badge {
  width: 104px;
  text-align: center;
}

.badge img {
  width: 78px;
  height: 90px;
  margin: 0 auto;
  object-fit: contain;
}

.badge figcaption {
  display: flex;
  flex-direction: column;
  min-height: 50px;
  margin-top: 7px;
  font-size: 12.5px;
  font-weight: 600;
  line-height: 1.35;
}

.badge small {
  display: block;
  margin-top: auto;
  padding-top: 3px;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--green-600);
}

/* ---------- Tab bar ---------- */

.tabbar {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 20;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  height: 78px;
  padding: 10px 34px 0;
  border-top: 1px solid #ecefed;
  background: var(--white);
}

.tab {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  width: 64px;
  border: 0;
  background: transparent;
  color: var(--gray-400);
  transition: color 140ms var(--ease-out);
}

.tab-icon {
  display: grid;
  place-items: center;
  width: 40px;
  height: 30px;
  border-radius: 9px;
  transition: background-color 150ms var(--ease-out);
}

.tab-icon svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.tab-label {
  font-size: 11px;
  font-weight: 600;
}

.tab.is-active {
  color: var(--green-900);
}

.tab.is-active .tab-icon {
  background: var(--green-light);
}

.plus {
  position: absolute;
  bottom: 24px;
  left: 50%;
  display: grid;
  place-items: center;
  width: 62px;
  height: 62px;
  border: 0;
  border-radius: 50%;
  background: var(--green-900);
  color: var(--white);
  transform: translateX(-50%);
  box-shadow: 0 10px 22px -8px rgba(1, 45, 29, 0.55);
  transition:
    transform 140ms var(--ease-out),
    background-color 140ms var(--ease-out);
}

.plus svg {
  width: 26px;
  height: 26px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
}

.plus:hover {
  background: var(--green-800);
}

.plus:active {
  transform: translateX(-50%) scale(0.94);
}

/* ---------- Toast ---------- */

.toast {
  position: absolute;
  bottom: 100px;
  left: 50%;
  z-index: 60;
  max-width: calc(100% - 40px);
  padding: 10px 16px;
  border-radius: 999px;
  background: var(--green-900);
  color: var(--white);
  font-size: 12.5px;
  font-weight: 500;
  white-space: nowrap;
  opacity: 0;
  transform: translate(-50%, 8px);
  pointer-events: none;
  transition:
    opacity 180ms var(--ease-out),
    transform 180ms var(--ease-out);
}

.toast.is-visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

/* ---------- Comments sheet ---------- */

.sheet {
  position: absolute;
  inset: 0;
  z-index: 40;
}

.sheet[hidden] {
  display: none;
}

.sheet-scrim {
  position: absolute;
  inset: 0;
  border: 0;
  background: rgba(1, 29, 19, 0.42);
  animation: fadeIn 180ms var(--ease-out) both;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.sheet-panel {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  max-height: 72%;
  display: flex;
  flex-direction: column;
  padding: 18px 18px 22px;
  border-radius: 24px 24px 0 0;
  background: var(--white);
  animation: sheetIn 240ms var(--ease-out) both;
}

@keyframes sheetIn {
  from {
    transform: translateY(24px);
    opacity: 0.6;
  }
  to {
    transform: none;
    opacity: 1;
  }
}

.sheet-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.sheet-head h2 {
  margin: 0;
  font-family: "Jakarta", sans-serif;
  font-size: 19px;
  font-weight: 800;
}

.sheet-close {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border: 0;
  border-radius: 50%;
  background: var(--gray-100);
  color: var(--gray-500);
}

.sheet-close svg {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
}

.sheet-body {
  overflow-y: auto;
}

.comment {
  display: flex;
  gap: 10px;
  padding: 10px 0;
  border-top: 1px solid #f2f4f3;
}

.comment:first-child {
  border-top: 0;
}

.comment .avatar {
  width: 32px;
  height: 32px;
  font-size: 11px;
}

.comment strong {
  display: block;
  font-size: 12.5px;
  font-weight: 700;
}

.comment p {
  margin: 2px 0 0;
  font-size: 13px;
  line-height: 1.45;
  color: var(--gray-600);
}

.comment .time {
  display: block;
  margin-top: 3px;
  font-size: 10.5px;
  color: var(--gray-400);
}

.sheet-form {
  display: flex;
  gap: 8px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid #f2f4f3;
}

.sheet-form input {
  flex: 1;
  min-width: 0;
  height: 42px;
  padding: 0 14px;
  border: 1px solid var(--gray-200);
  border-radius: 999px;
  background: var(--white);
  font-size: 13px;
  outline: none;
}

.sheet-form input:focus {
  border-color: var(--green-600);
}

.sheet-form button {
  height: 42px;
  padding: 0 16px;
  border: 0;
  border-radius: 999px;
  background: var(--green-900);
  color: var(--white);
  font-size: 13px;
  font-weight: 700;
}

/* ---------- Level up ---------- */

.levelup {
  position: absolute;
  inset: 0;
  z-index: 50;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 30px 28px;
  overflow: hidden;
  background: var(--green-900);
  color: var(--white);
  text-align: center;
}

.levelup[hidden] {
  display: none;
}

.levelup::before {
  content: "";
  position: absolute;
  inset: -20%;
  background: repeating-conic-gradient(
    from 0deg at 50% 38%,
    rgba(255, 255, 255, 0.035) 0deg 6deg,
    rgba(255, 255, 255, 0) 6deg 13deg
  );
  pointer-events: none;
}

.levelup::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(78% 58% at 50% 42%, rgba(1, 45, 29, 0) 30%, rgba(1, 45, 29, 0.7) 100%);
  pointer-events: none;
}

.levelup > * {
  z-index: 1;
}

.levelup-badge-wrap {
  position: relative;
  display: grid;
  place-items: center;
  width: 110px;
  height: 137px;
}

.levelup-badge-num {
  position: absolute;
  top: 47%;
  left: 50%;
  z-index: 2;
  transform: translate(-50%, -50%);
  color: #fff;
  font-family: "Jakarta", sans-serif;
  font-size: 32px;
  font-weight: 800;
  line-height: 1;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.12);
}

.levelup-badge {
  position: relative;
  width: 110px;
  height: 137px;
  object-fit: contain;
  animation: badgeIn 420ms var(--ease-spring) both;
}

@keyframes badgeIn {
  from {
    opacity: 0;
    transform: scale(0.86);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.levelup-line {
  position: relative;
  margin: 18px 0 0;
  font-size: 20px;
  font-weight: 500;
  line-height: 1.3;
}

.levelup-habit {
  position: relative;
  margin: 4px 0;
  font-family: "Jakarta", sans-serif;
  font-size: 29px;
  font-weight: 800;
  line-height: 1.2;
  letter-spacing: -0.6px;
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 4px;
}

.levelup-keep {
  position: relative;
  margin: 16px 0 0;
  font-size: 15px;
  color: var(--mint);
}

.levelup-btn {
  position: relative;
  width: 100%;
  max-width: 320px;
  height: 54px;
  margin-top: 34px;
  border: 0;
  border-radius: 999px;
  background: var(--white);
  color: var(--green-900);
  font-size: 16px;
  font-weight: 700;
  transition: transform 120ms var(--ease-out);
}

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

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 1ms !important;
    animation-delay: 0ms !important;
    transition-duration: 1ms !important;
  }
}
