/* ===== VNTR FIT styles ===== */

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

:root {
  --paper: #f4efe6;
  --paper-soft: #ece5d6;
  --paper-line: #d9cfba;
  --paper-deep: #e0d8c2;
  --ink: #1c1a17;
  --ink-soft: #4a463f;
  --ink-quiet: #7a7368;
  --olive: #5a6438;
  --olive-deep: #3d4625;
  --rust: #8a3a1a;
  --serif: 'Fraunces', 'Georgia', serif;
  --sans: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

html, body {
  margin: 0;
  padding: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  min-height: 100dvh;
  overscroll-behavior-y: contain;
}

body {
  background-image:
    radial-gradient(ellipse 80% 50% at 50% 0%, rgba(58, 53, 45, 0.04) 0%, transparent 60%);
}

.paper {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  min-height: 100dvh;
  padding: 24px 22px 40px;
  display: flex;
  flex-direction: column;
}

.screen {
  display: flex;
  flex-direction: column;
  flex: 1;
  animation: fadeIn 0.3s ease-out;
}

.screen[hidden] {
  display: none !important;
}

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

/* ===== Brand / header ===== */
.brand {
  text-align: center;
  margin-top: 8px;
  margin-bottom: 56px;
}

.brand-mark {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 26px;
  letter-spacing: 0.02em;
  color: var(--ink);
}

.brand-mark-divider {
  font-weight: 400;
  color: var(--olive);
  margin: 0 4px;
}

.brand-tagline {
  font-family: var(--serif);
  font-style: italic;
  font-size: 14px;
  color: var(--ink-quiet);
  margin-top: 6px;
  letter-spacing: 0.01em;
}

/* ===== User picker ===== */
.userScreen {
  justify-content: flex-start;
}

.prompt {
  margin-bottom: 32px;
}

.prompt-title {
  font-family: var(--serif);
  font-weight: 500;
  font-size: 32px;
  line-height: 1.15;
  margin: 0 0 8px;
  letter-spacing: -0.01em;
}

.prompt-sub {
  color: var(--ink-quiet);
  font-size: 15px;
  margin: 0;
}

.user-pick {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 40px;
}

.user-pick-btn {
  background: var(--paper-soft);
  border: 1px solid var(--paper-line);
  border-radius: 0;
  padding: 22px 24px;
  font-family: var(--serif);
  font-weight: 500;
  font-size: 22px;
  color: var(--ink);
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: background 0.15s, border-color 0.15s;
  text-align: left;
}

.user-pick-btn:active {
  background: var(--paper-line);
}

.user-pick-arrow {
  font-family: var(--sans);
  font-size: 20px;
  color: var(--olive);
  transition: transform 0.2s;
}

.user-pick-btn:active .user-pick-arrow {
  transform: translateX(4px);
}

/* ===== Log header ===== */
.log-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 32px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--paper-line);
}

/* ===== View toggle (Entry / Dashboard) ===== */
/* Used in the log header, on the success screen, and on the dashboard top.
   Two text labels with a sliding indicator behind them. */
.view-toggle {
  position: relative;
  display: grid;
  grid-template-columns: 1fr 1fr;
  background: var(--paper-soft);
  border: 1px solid var(--paper-line);
  border-radius: 999px;
  padding: 3px;
  width: 220px;
  flex-shrink: 0;
  isolation: isolate; /* keep the indicator's z-index local */
}
.view-toggle-pill {
  position: absolute;
  top: 3px;
  bottom: 3px;
  left: 3px;
  width: calc(50% - 3px);
  background: var(--ink);
  border-radius: 999px;
  z-index: 0;
  transition: transform 0.22s cubic-bezier(0.4, 0.0, 0.2, 1);
  will-change: transform;
}
.view-toggle[data-active="dashboard"] .view-toggle-pill {
  transform: translateX(100%);
}
.view-toggle-btn {
  position: relative;
  z-index: 1;
  padding: 9px 16px;
  text-align: center;
  font-family: var(--serif);
  font-weight: 500;
  font-size: 14px;
  color: var(--ink-quiet);
  background: transparent;
  border: 0;
  cursor: pointer;
  border-radius: 999px;
  letter-spacing: 0.005em;
  transition: color 0.22s cubic-bezier(0.4, 0.0, 0.2, 1);
}
.view-toggle-btn.active {
  color: var(--paper);
}
.view-toggle-btn:not(.active):hover {
  color: var(--ink);
}
.view-toggle-btn:focus-visible {
  outline: 2px solid var(--olive);
  outline-offset: 2px;
}

.log-header-mark {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 17px;
  letter-spacing: 0.02em;
}

.log-header-user {
  background: transparent;
  border: 0;
  font-family: var(--sans);
  font-size: 13px;
  color: var(--ink-soft);
  cursor: pointer;
  padding: 4px 0;
  display: flex;
  align-items: center;
  gap: 4px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.log-header-user-arrow {
  font-size: 14px;
  color: var(--olive);
}

/* ===== Log screen ===== */
.log-date {
  font-family: var(--serif);
  font-style: italic;
  font-size: 13px;
  color: var(--ink-quiet);
  margin-bottom: 6px;
  letter-spacing: 0.02em;
}

.log-title {
  font-family: var(--serif);
  font-weight: 500;
  font-size: 30px;
  line-height: 1.15;
  margin: 0 0 28px;
  letter-spacing: -0.01em;
}

.type-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 32px;
}

.type-btn {
  background: var(--paper-soft);
  border: 1px solid var(--paper-line);
  padding: 22px 18px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 18px;
  transition: background 0.15s, border-color 0.15s, transform 0.1s;
  text-align: left;
  min-height: 100px;
  font-family: var(--sans);
}

.type-btn:active {
  background: var(--paper-line);
  transform: scale(0.985);
}

.type-btn-num {
  font-family: var(--serif);
  font-style: italic;
  font-weight: 400;
  font-size: 13px;
  color: var(--olive);
  letter-spacing: 0.04em;
}

.type-btn-label {
  font-family: var(--serif);
  font-weight: 500;
  font-size: 19px;
  color: var(--ink);
  letter-spacing: -0.005em;
}

.type-btn-workout {
  grid-column: 1 / -1;
  background: var(--ink);
  border-color: var(--ink);
  color: var(--paper);
}

.type-btn-workout .type-btn-num {
  color: var(--paper-line);
}

.type-btn-workout .type-btn-label {
  color: var(--paper);
}

.type-btn-workout:active {
  background: var(--olive-deep);
  border-color: var(--olive-deep);
}

/* ===== Entry form screens ===== */
.entry-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;
  padding-top: 4px;
}

.entry-back {
  background: transparent;
  border: 0;
  color: var(--ink-soft);
  font-family: var(--sans);
  font-size: 14px;
  cursor: pointer;
  padding: 4px 0;
  letter-spacing: 0.01em;
}

.entry-header-type {
  font-family: var(--serif);
  font-style: italic;
  font-size: 14px;
  color: var(--ink-quiet);
  letter-spacing: 0.02em;
}

.entry-divider {
  height: 1px;
  background: var(--paper-line);
  margin: 16px 0 28px;
}

.entry-form {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.field[hidden] {
  display: none;
}

.field-label {
  font-family: var(--sans);
  font-weight: 500;
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

.field-input {
  background: var(--paper-soft);
  border: 1px solid var(--paper-line);
  font-family: var(--serif);
  font-weight: 400;
  font-size: 17px;
  color: var(--ink);
  padding: 14px 16px;
  width: 100%;
  resize: none;
  -webkit-appearance: none;
  appearance: none;
  border-radius: 0;
  line-height: 1.5;
  transition: border-color 0.15s, background 0.15s;
}

.field-input:focus {
  outline: none;
  border-color: var(--olive);
  background: var(--paper);
}

.field-input::placeholder {
  color: var(--ink-quiet);
  font-style: italic;
}

.field-input-textarea {
  min-height: 80px;
}

/* ===== Workout options ===== */
.workout-options {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.workout-option {
  display: block;
  cursor: pointer;
}

.workout-option input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.workout-option-card {
  display: flex;
  flex-direction: column;
  gap: 4px;
  background: var(--paper-soft);
  border: 1px solid var(--paper-line);
  padding: 16px 18px;
  transition: background 0.15s, border-color 0.15s;
}

.workout-option input:checked + .workout-option-card {
  background: var(--ink);
  border-color: var(--ink);
}

.workout-option-name {
  font-family: var(--serif);
  font-weight: 500;
  font-size: 18px;
  color: var(--ink);
}

.workout-option-desc {
  font-family: var(--sans);
  font-size: 13px;
  color: var(--ink-quiet);
}

.workout-option input:checked + .workout-option-card .workout-option-name {
  color: var(--paper);
}

.workout-option input:checked + .workout-option-card .workout-option-desc {
  color: var(--paper-line);
}

/* ===== Submit button ===== */
.submit-btn {
  background: var(--olive);
  border: 0;
  color: var(--paper);
  padding: 18px 24px;
  font-family: var(--sans);
  font-weight: 500;
  font-size: 15px;
  letter-spacing: 0.02em;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: background 0.15s;
  margin-top: 8px;
}

.submit-btn:active {
  background: var(--olive-deep);
}

.submit-btn:disabled {
  background: var(--paper-line);
  color: var(--ink-quiet);
  cursor: not-allowed;
}

.submit-btn-label {
  font-weight: 500;
}

.submit-btn-arrow {
  font-size: 16px;
}

/* ===== Success screen ===== */
.successScreen {
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 40px 20px;
  position: relative;
}

.success-header {
  position: absolute;
  top: 24px;
  left: 50%;
  transform: translateX(-50%);
}

.success-mark {
  font-size: 48px;
  color: var(--olive);
  font-weight: 400;
  margin-bottom: 24px;
  animation: successPop 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes successPop {
  0% { transform: scale(0.6); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

.success-title {
  font-family: var(--serif);
  font-weight: 500;
  font-size: 36px;
  margin: 0 0 8px;
  letter-spacing: -0.01em;
}

.success-sub {
  font-family: var(--serif);
  font-style: italic;
  color: var(--ink-quiet);
  font-size: 15px;
  margin: 0 0 40px;
}

.success-again {
  background: var(--ink);
  border: 0;
  color: var(--paper);
  padding: 16px 28px;
  font-family: var(--sans);
  font-weight: 500;
  font-size: 14px;
  cursor: pointer;
  margin-bottom: 24px;
  letter-spacing: 0.02em;
}

.success-again:active {
  background: var(--ink-soft);
}

.dashboard-link {
  display: inline-block;
  font-family: var(--sans);
  font-size: 13px;
  color: var(--ink-soft);
  text-decoration: none;
  border-bottom: 1px solid var(--paper-line);
  padding-bottom: 2px;
  letter-spacing: 0.02em;
  align-self: center;
  margin-top: auto;
}

.dashboard-link:active {
  color: var(--olive);
}

.dashboard-link-inline {
  margin-top: 0;
  align-self: flex-start;
}

/* ===== Loading state ===== */
.submit-btn.loading {
  background: var(--ink-soft);
  pointer-events: none;
}

.submit-btn.loading .submit-btn-label::after {
  content: '...';
  display: inline-block;
  animation: dots 1.4s infinite;
}

@keyframes dots {
  0%, 20% { content: '.'; }
  40% { content: '..'; }
  60%, 100% { content: '...'; }
}

/* ===== Error toast ===== */
.toast {
  position: fixed;
  top: 16px;
  left: 16px;
  right: 16px;
  background: var(--ink);
  color: var(--paper);
  padding: 12px 16px;
  font-family: var(--sans);
  font-size: 14px;
  z-index: 100;
  animation: toastIn 0.3s ease-out;
  max-width: 480px;
  margin: 0 auto;
}

.toast.toast-error {
  background: var(--rust);
}

@keyframes toastIn {
  from { transform: translateY(-100%); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}
