/* =========================================================
   GoXL Daily Check-In — Design Tokens
   ========================================================= */
:root{
  /* Brand */
  --forest:        #1B4332;
  --forest-dark:    #0F2A1F;
  --emerald:        #10B981;
  --emerald-dark:   #0B9268;
  --mint:           #D1FAE5;
  --mint-soft:      #ECFDF5;

  /* Neutrals */
  --paper:          #FAFAF8;
  --card:           #FFFFFF;
  --ink:            #1C2622;
  --slate:          #475569;
  --slate-soft:     #94A3B8;
  --line:           #E7E5E0;

  /* Type */
  --font-display:   'Fraunces', Georgia, serif;
  --font-body:      'Inter', -apple-system, BlinkMacSystemFont, sans-serif;

  /* Shape & motion */
  --radius-lg:      22px;
  --radius-md:      16px;
  --radius-sm:      10px;
  --shadow-card:    0 1px 2px rgba(27,67,50,0.04), 0 8px 24px -8px rgba(27,67,50,0.10);
  --shadow-card-hover: 0 2px 4px rgba(27,67,50,0.06), 0 16px 32px -12px rgba(27,67,50,0.16);
  --ease:           cubic-bezier(.4,0,.2,1);
}

@media (prefers-reduced-motion: reduce){
  *{ animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
}

*{ box-sizing: border-box; }
html{ -webkit-text-size-adjust: 100%; }

body{
  margin: 0;
  background: var(--paper);
  background-image:
    radial-gradient(circle at 12% 0%, rgba(16,185,129,0.07), transparent 45%),
    radial-gradient(circle at 90% 8%, rgba(27,67,50,0.05), transparent 40%);
  color: var(--ink);
  font-family: var(--font-body);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  position: relative;
}

/* Watermark: GoXL mark, fixed and faint behind all content */
/* =========================================================
   Full-page GOXL Watermark
   ========================================================= */

body::before{
  content: '';
  position: fixed;
  inset: 0;

  background-image: url('assets/goxl-logo.jpeg');
  background-repeat: no-repeat;
  background-position: center center;

  /* Make logo huge */
  background-size: 95vw auto;

  /* Keep behind everything */
  z-index: -1;

  /* Visible but subtle */
  opacity: 0.08;

  pointer-events: none;
}

.page{
  position: relative;
  z-index: 1;
  max-width: 560px;
  margin: 0 auto;
  padding: 0 18px 48px;
}

/* =========================================================
   Hero
   ========================================================= */
.hero{
  padding: 40px 4px 8px;
  text-align: left;
}

.hero__mark{
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 0.18em;
  color: var(--emerald-dark);
  text-transform: uppercase;
  margin-bottom: 18px;
}

.hero__title{
  font-family: var(--font-display);
  font-weight: 500;
  font-optical-sizing: auto;
  font-size: clamp(28px, 7vw, 38px);
  line-height: 1.12;
  letter-spacing: -0.01em;
  color: var(--forest-dark);
  margin: 0 0 12px;
}

.hero__tagline{
  font-size: 15px;
  color: var(--slate);
  margin: 0;
  font-style: italic;
  font-family: var(--font-display);
}

/* =========================================================
   Greeting
   ========================================================= */
.greeting{
  padding: 22px 4px 4px;
}
.greeting__hello{
  font-size: 20px;
  font-weight: 600;
  margin: 0 0 4px;
  color: var(--ink);
}
.greeting__sub{
  font-size: 14.5px;
  color: var(--slate);
  margin: 0;
}

/* =========================================================
   Progress ring strip
   ========================================================= */
.progress{
  display: flex;
  align-items: center;
  gap: 16px;
  margin: 22px 0 6px;
  padding: 16px 18px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
}

.progress__ring{
  position: relative;
  width: 56px;
  height: 56px;
  flex: none;
}
.progress__ring svg{ transform: rotate(-90deg); }
.progress__track{
  fill: none;
  stroke: var(--mint-soft);
  stroke-width: 5;
}
.progress__fill{
  fill: none;
  stroke: var(--emerald);
  stroke-width: 5;
  stroke-linecap: round;
  stroke-dasharray: 169.6;
  stroke-dashoffset: 169.6;
  transition: stroke-dashoffset 0.5s var(--ease);
}
.progress__count{
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--forest-dark);
}

.progress__label{
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.progress__label-title{
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
}
.progress__label-sub{
  font-size: 12.5px;
  color: var(--slate-soft);
  transition: color .3s var(--ease);
}
.progress__label-sub.is-complete{
  color: var(--emerald-dark);
  font-weight: 600;
}

/* =========================================================
   Habit cards
   ========================================================= */
.habits{
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  margin: 18px 0 4px;
}

.habit-group{
  display: flex;
  flex-direction: column;
}

.habit-card{
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  text-align: left;
  padding: 16px 16px;
  background: var(--card);
  border: 1.5px solid var(--line);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
  cursor: pointer;
  font-family: inherit;
  transition: border-color .22s var(--ease), background .22s var(--ease),
              box-shadow .22s var(--ease), transform .15s var(--ease);
  -webkit-tap-highlight-color: transparent;
}

.habit-card:hover{
  box-shadow: var(--shadow-card-hover);
}

.habit-card:active{
  transform: scale(0.985);
}

.habit-card:focus-visible{
  outline: 2px solid var(--emerald);
  outline-offset: 2px;
}

.habit-card__icon{
  font-size: 22px;
  flex: none;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--mint-soft);
  border-radius: 12px;
  transition: background .22s var(--ease), transform .3s var(--ease);
}

.habit-card__text{
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
  min-width: 0;
}

.habit-card__title{
  font-size: 15px;
  font-weight: 600;
  color: var(--ink);
}

.habit-card__hint{
  font-size: 12.5px;
  color: var(--slate-soft);
  line-height: 1.3;
}

.habit-card__check{
  flex: none;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 1.5px solid var(--line);
  background: var(--paper);
  position: relative;
  transition: all .22s var(--ease);
}

.habit-card__check::after{
  content: '';
  position: absolute;
  top: 50%; left: 50%;
  width: 11px; height: 7px;
  border-left: 2px solid white;
  border-bottom: 2px solid white;
  transform: translate(-50%,-60%) rotate(-45deg) scale(0);
  transition: transform .2s var(--ease);
}

/* Selected state */
.habit-card.is-selected{
  border-color: var(--emerald);
  background: var(--mint-soft);
}
.habit-card.is-selected .habit-card__icon{
  background: var(--mint);
  transform: scale(1.06);
}
.habit-card.is-selected .habit-card__check{
  background: var(--emerald);
  border-color: var(--emerald);
}
.habit-card.is-selected .habit-card__check::after{
  transform: translate(-50%,-60%) rotate(-45deg) scale(1);
}

/* When a note panel is open beneath, flatten the card's bottom corners
   so the two pieces read as one connected unit */
.habit-group.has-note-open .habit-card{
  border-radius: var(--radius-md) var(--radius-md) 0 0;
  border-bottom-color: transparent;
}

/* =========================================================
   Per-habit note panel
   ========================================================= */
.habit-note{
  background: var(--mint-soft);
  border: 1.5px solid var(--emerald);
  border-top: none;
  border-radius: 0 0 var(--radius-md) var(--radius-md);
  padding: 14px 16px 16px;
  margin-top: -1px;
  animation: noteOpen .22s var(--ease);
}

@keyframes noteOpen{
  from{ opacity: 0; transform: translateY(-6px); }
  to{ opacity: 1; transform: translateY(0); }
}

.habit-note__label{
  display: block;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--forest-dark);
  margin-bottom: 6px;
}

.habit-note__textarea{
  width: 100%;
  resize: vertical;
  min-height: 56px;
  padding: 10px 12px;
  font-family: var(--font-body);
  font-size: 13.5px;
  line-height: 1.45;
  color: var(--ink);
  background: var(--card);
  border: 1.5px solid var(--line);
  border-radius: var(--radius-sm);
  transition: border-color .2s var(--ease), box-shadow .2s var(--ease);
}

.habit-note__textarea:focus{
  outline: none;
  border-color: var(--emerald);
  box-shadow: 0 0 0 4px rgba(16,185,129,0.14);
}

.habit-note__textarea::placeholder{
  color: var(--slate-soft);
}

.habit-note__error{
  display: none;
  margin-top: 6px;
  font-size: 12px;
  color: #B91C1C;
  font-weight: 500;
}

.habit-note.has-error .habit-note__textarea{
  border-color: #B91C1C;
}
.habit-note.has-error .habit-note__error{
  display: block;
}

/* =========================================================
   Reflection
   ========================================================= */
.reflection{
  margin: 26px 0 4px;
  padding: 18px 18px 14px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
}

.reflection__label{
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  font-size: 15px;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 10px;
}

.reflection__optional{
  font-size: 11px;
  font-weight: 600;
  color: var(--slate-soft);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.reflection__textarea{
  width: 100%;
  resize: vertical;
  min-height: 96px;
  padding: 12px 14px;
  font-family: var(--font-body);
  font-size: 14.5px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--paper);
  border: 1.5px solid var(--line);
  border-radius: var(--radius-sm);
  transition: border-color .2s var(--ease), box-shadow .2s var(--ease);
}

.reflection__textarea:focus{
  outline: none;
  border-color: var(--emerald);
  box-shadow: 0 0 0 4px rgba(16,185,129,0.12);
}

.reflection__textarea::placeholder{
  color: var(--slate-soft);
}

.reflection__counter{
  display: block;
  text-align: right;
  font-size: 11.5px;
  color: var(--slate-soft);
  margin-top: 6px;
}

/* =========================================================
   Submit
   ========================================================= */
.submit-section{
  margin-top: 28px;
}

.submit-btn{
  position: relative;
  width: 100%;
  padding: 17px 20px;
  font-family: inherit;
  font-size: 15.5px;
  font-weight: 700;
  letter-spacing: 0.01em;
  color: #fff;
  background: linear-gradient(135deg, var(--forest) 0%, var(--forest-dark) 100%);
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  box-shadow: 0 10px 24px -8px rgba(15,42,31,0.45);
  transition: transform .15s var(--ease), box-shadow .2s var(--ease), opacity .2s var(--ease);
  -webkit-tap-highlight-color: transparent;
}

.submit-btn:hover{
  box-shadow: 0 14px 28px -8px rgba(15,42,31,0.5);
}

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

.submit-btn:focus-visible{
  outline: 2px solid var(--emerald);
  outline-offset: 3px;
}

.submit-btn:disabled{
  cursor: not-allowed;
  opacity: 0.85;
}

.submit-btn__spinner{
  display: none;
  position: absolute;
  top: 50%; left: 50%;
  width: 18px; height: 18px;
  margin: -9px 0 0 -9px;
  border: 2.5px solid rgba(255,255,255,0.35);
  border-top-color: #fff;
  border-radius: 50%;
}

.submit-btn.is-loading .submit-btn__label{
  visibility: hidden;
}
.submit-btn.is-loading .submit-btn__spinner{
  display: block;
  animation: spin 0.7s linear infinite;
}

@keyframes spin{
  to{ transform: rotate(360deg); }
}

.submit-error{
  margin: 12px 4px 0;
  font-size: 13px;
  color: #B91C1C;
  text-align: center;
  min-height: 16px;
}

/* =========================================================
   Success view
   ========================================================= */
.view--success{
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 4px;
}

.view--success[hidden]{
  display: none;
}

.success{
  width: 100%;
  text-align: center;
  padding: 48px 28px 36px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card-hover);
  animation: rise .5s var(--ease);
}

@keyframes rise{
  from{ opacity: 0; transform: translateY(14px); }
  to{ opacity: 1; transform: translateY(0); }
}

.success__badge{
  margin: 0 auto 22px;
  width: 64px; height: 64px;
}

.success__circle{
  fill: var(--mint-soft);
  stroke: var(--emerald);
  stroke-width: 2;
}

.success__check{
  fill: none;
  stroke: var(--emerald-dark);
  stroke-width: 4;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 40;
  stroke-dashoffset: 40;
  animation: draw .5s .25s var(--ease) forwards;
}

@keyframes draw{
  to{ stroke-dashoffset: 0; }
}

.success__title{
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 500;
  color: var(--forest-dark);
  margin: 0 0 10px;
}

.success__text{
  font-size: 15px;
  color: var(--ink);
  margin: 0 0 4px;
  line-height: 1.5;
}

.success__sub{
  font-size: 13.5px;
  color: var(--slate-soft);
  margin: 0 0 28px;
  font-style: italic;
  font-family: var(--font-display);
}

.success__done{
  width: 100%;
  padding: 15px 20px;
  font-family: inherit;
  font-size: 15px;
  font-weight: 700;
  color: var(--forest-dark);
  background: var(--mint-soft);
  border: 1.5px solid var(--mint);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: background .2s var(--ease), transform .15s var(--ease);
}

.success__done:hover{
  background: var(--mint);
}
.success__done:active{
  transform: scale(0.985);
}
.success__done:focus-visible{
  outline: 2px solid var(--emerald);
  outline-offset: 2px;
}

/* =========================================================
   Small screens fine-tuning
   ========================================================= */
@media (max-width: 360px){
  .page{ padding: 0 14px 40px; }
  .hero{ padding-top: 28px; }
  .habit-card{ padding: 14px; gap: 12px; }
}

/* Larger screens: gentle breathing room, still mobile-first card */
@media (min-width: 640px){
  .page{ padding-top: 24px; }
}