/* Redesign, profile workstream.
   Tokens, the layout system and the type atoms live in redesign.css; this file is the
   only stylesheet the profile pages own. See docs/redesign-workstreams.md.

   Screens: 9 / 17 / 18 profile, 19 edit profile, 20 settings.

   Elements::ProfileBadgeComponent and Elements::PercentProgressBarComponent are also
   rendered by lesson completion, the eudaimonia survey steps, the profile steps, the
   admin user rows and the course cards. Every rule that touches them is scoped under
   a page class (.rd-profile / .rd-edit / .rd-settings); the components themselves only
   gained class hooks, so those other screens keep their appearance. */

/* ---------- 9 / 17 · Profile: head ---------- */

.rd-profile {
  background: var(--rd-paper-white);
}

.rd-profile__head {
  text-align: center;
}

.rd-profile__avatar,
.rd-edit__avatar {
  display: flex;
  justify-content: center;
}
/* the shared avatar partial sets its own circle; the design draws it at 70px */
.rd-profile__avatar > div,
.rd-edit__avatar > div {
  width: 70px;
  height: 70px;
  border-color: #cdbfb0;
}
.rd-profile__avatar img,
.rd-edit__avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.rd-profile__avatar svg,
.rd-edit__avatar svg {
  width: 30px;
  height: 30px;
}

.rd-profile__name {
  margin-top: var(--rd-space-xs);
  font-size: 14px;
  font-weight: 400;
  letter-spacing: 0.24em;
  line-height: 1.32;
  text-transform: uppercase;
}

.rd-profile__stats {
  margin-top: var(--rd-space-l);
  display: grid;
  grid-template-columns: repeat(3, 1fr);
}
.rd-profile__stat b {
  display: block;
  font-size: 34px;
  font-weight: 200;
  line-height: 1.1;
}
.rd-profile__stat b.rd-profile__stat-word {
  font-family: var(--rd-serif);
  font-style: italic;
  font-weight: 400;
  font-size: 27px;
  line-height: 1.38;
}
.rd-profile__stat-label {
  display: block;
  margin-top: 2px;
  font-size: 10px;
  font-weight: 400;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--rd-ink-label);
}

.rd-profile__edit {
  display: inline-block;
  margin-top: var(--rd-space-m);
}

/* ---------- 9 / 17 / 18 · Profile: tabs ---------- */

.rd-profile__tabs {
  margin-top: var(--rd-space-l);
  display: flex;
  justify-content: center;
  gap: var(--rd-space-l);
}
.rd-profile__tab {
  padding: 0 2px;
  border: 0;
  background: none;
  cursor: pointer;
  white-space: nowrap;
  line-height: 1.1;
  font-family: var(--rd-sans);
  font-size: 11.5px;
  font-weight: 400;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--rd-ink-label);
}
/* We keep three tabs where the design draws two (Courses is the only entry point to
   enrolled courses), so the row steps down a size on the narrowest phones rather than
   wrapping the active tab's highlight onto a second line. */
@media (max-width: 360px) {
  .rd-profile__tabs {
    gap: var(--rd-space-xs);
  }
  .rd-profile__tab {
    font-size: 9.5px;
    letter-spacing: 0.12em;
  }
}
/* the active tab is marked with the design's peach highlight, not a border */
.rd-profile__tab.active {
  color: var(--rd-ink);
  background: linear-gradient(
    transparent 46%,
    var(--rd-highlight) 46%,
    var(--rd-highlight) 92%,
    transparent 92%
  );
}
.rd-profile__tab:focus-visible {
  outline: 2px solid var(--rd-accent);
  outline-offset: 3px;
}

.rd-profile__panel {
  padding-top: var(--rd-space-l);
}

/* the empty state before the first survey */
.rd-profile__empty {
  text-align: center;
}
.rd-profile__empty p {
  font-family: var(--rd-serif);
  font-style: italic;
  font-size: 19px;
  line-height: 1.25;
  color: var(--rd-ink-soft);
}
.rd-profile__empty form,
.rd-profile__courses form {
  margin-top: var(--rd-space-m);
  display: flex;
  justify-content: center;
}
.rd-profile__empty .rd-pill,
.rd-profile__courses .rd-pill {
  width: auto;
}
.rd-profile__course-list {
  margin-top: var(--rd-space-l);
  display: grid;
  gap: var(--rd-space-m);
}

/* ---------- 18 · Profile: badges ---------- */

.rd-profile__badges {
  display: grid;
  gap: var(--rd-space-m);
}

/* the badge row keeps the component's markup: name and count on one line, one fine
   line under both. The badge art is drawn by the design's profile screen without it. */
.rd-profile .rd-badge {
  display: block;
  margin: 0;
  padding: 0;
  background: none;
}
.rd-profile .rd-badge__art {
  display: none;
}
.rd-profile .rd-badge__text {
  width: 100%;
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: baseline;
  column-gap: var(--rd-space-s);
  row-gap: var(--rd-space-xs);
}
.rd-profile .rd-badge__label {
  grid-column: 1;
  grid-row: 1;
  margin: 0;
  font-family: var(--rd-serif);
  font-weight: 500;
  font-size: 19.5px;
  line-height: 1.1;
}
/* The bar component is a flex row of [track, count]. Dissolving both wrappers lets the
   count sit on the name's line and the track run under the whole row. */
.rd-profile .rd-badge__progress,
.rd-profile .rd-badge__progress > div {
  display: contents;
}
.rd-profile .rd-badge__progress > div > div:first-child {
  grid-column: 1 / -1;
  grid-row: 2;
  height: 2px;
  border-radius: 0;
  background: var(--rd-hairline);
}
.rd-profile .rd-badge__progress > div > div:first-child > div {
  height: 2px;
  border-radius: 0;
  background: var(--rd-ochre);
}
.rd-profile .rd-badge__progress > div > div:last-child {
  grid-column: 2;
  grid-row: 1;
  width: auto;
  font-family: var(--rd-sans);
  font-size: 14px;
  font-weight: 300;
  letter-spacing: 0.06em;
  text-align: right;
  color: var(--rd-ink-label);
}
.rd-profile .rd-badge--done .rd-badge__progress > div > div:last-child {
  font-size: 10.5px;
  font-weight: 400;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--rd-accent);
}

/* ---------- 9 / 17 · Eudaimonia results (eudaimonia_surveys/_results) ---------- */

.rd-res {
  text-align: center;
}
.rd-res__pills {
  display: flex;
  justify-content: center;
  gap: var(--rd-space-s);
}
.rd-res__pill {
  width: auto;
  height: 36px;
  padding: 0 22px;
  border: 0;
  border-radius: 30px;
  background: transparent;
  box-shadow: inset 0 0 0 1px var(--rd-ink);
  cursor: pointer;
  font-family: var(--rd-sans);
  font-size: 10.5px;
  font-weight: 400;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--rd-ink);
}
/* the survey tab controller toggles btn-primary / btn-light; those two names carry the
   selected state here instead of the app's filled button look */
.rd-res__pill.btn-primary {
  background: var(--rd-ink);
  border-color: var(--rd-ink);
  color: var(--rd-paper-white);
}
.rd-res__pill:focus-visible {
  outline: 2px solid var(--rd-accent);
  outline-offset: 3px;
}
.rd-res__panel {
  padding-top: var(--rd-space-l);
}
.rd-res__lede {
  font-family: var(--rd-serif);
  font-style: italic;
  font-size: 18px;
  line-height: 1.22;
  color: var(--rd-ink-soft);
  text-wrap: balance;
}
.rd-res__lede strong {
  font-weight: 400;
}
.rd-res__glyph {
  display: block;
  width: 44px;
  height: 52px;
  margin: var(--rd-space-s) auto 0;
  fill: none;
  stroke: var(--rd-ochre);
  stroke-width: 1.2;
}
.rd-res__word {
  margin-top: var(--rd-space-2xs);
  font-family: var(--rd-serif);
  font-style: italic;
  font-weight: 300;
  font-size: 50px;
  line-height: 1.05;
}
.rd-res__copy {
  margin-top: var(--rd-space-xs);
  font-family: var(--rd-serif);
  font-size: 16.5px;
  line-height: 1.28;
  color: var(--rd-ink-reading);
  text-wrap: pretty;
}

/* ---------- 19 · Edit profile ---------- */

.rd-edit {
  background: var(--rd-bone);
}
.rd-edit__photo {
  margin-top: var(--rd-space-s);
  text-align: center;
}
.rd-edit__photo .rd-link {
  background: none;
  border: 0;
  cursor: pointer;
}
.rd-edit__form {
  margin-top: var(--rd-space-2xl);
}
.rd-edit__fields {
  margin-top: var(--rd-space-xl);
}
.rd-edit__field + .rd-edit__field {
  margin-top: var(--rd-space-m);
}
.rd-edit__label {
  display: block;
  font-size: 10.5px;
  font-weight: 400;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--rd-accent);
}
/* The app's frontend form styling is written against #frontend + type selectors, so a
   single class cannot reach it: these two rules carry the id to drop the boxed field
   for the design's hairline one. */
#frontend .rd-edit__input,
#frontend .rd-edit__input:hover,
#frontend .rd-edit__input:focus {
  width: 100%;
  margin-top: 2px;
  padding: 6px 0 8px;
  border: 0;
  border-bottom: 1px solid rgba(51, 45, 43, 0.28);
  border-radius: 0;
  box-shadow: none;
  background: transparent;
  font-family: var(--rd-serif);
  font-size: 21px;
  line-height: 1.2;
  color: var(--rd-ink);
}
#frontend .rd-edit__input:focus-visible {
  outline: 2px solid var(--rd-accent);
  outline-offset: 2px;
  border-bottom-color: var(--rd-accent);
}
#frontend .rd-edit__input--off {
  color: #9a8b7e;
}
#frontend select.rd-edit__input--select {
  appearance: none;
  padding-right: 24px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%23332d2b' stroke-width='1.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M7 10l5 5 5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right center;
  font-size: 16px;
}
.rd-edit__note {
  margin-top: var(--rd-space-xs);
  font-family: var(--rd-serif);
  font-style: italic;
  font-size: 15px;
  line-height: 1.25;
  color: var(--rd-ink-muted);
  text-wrap: pretty;
}
.rd-edit__actions {
  margin-top: var(--rd-space-2xl);
  display: flex;
  align-items: center;
  gap: var(--rd-space-l);
}
.rd-edit__submit {
  width: auto;
  height: 48px;
  padding: 0 34px;
  border: 0;
  cursor: pointer;
}

/* ---------- 20 · Settings ---------- */

.rd-settings {
  background: var(--rd-paper-white);
}
.rd-settings__list {
  margin-top: var(--rd-space-xl);
  display: grid;
}
.rd-settings__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--rd-space-s);
  width: 100%;
  padding: var(--rd-space-s) 0;
  border: 0;
  background: none;
  text-align: left;
  text-decoration: none;
  color: var(--rd-ink);
  cursor: pointer;
}
.rd-settings__row b {
  font-family: var(--rd-serif);
  font-weight: 500;
  font-size: 22px;
  line-height: 1.15;
}
.rd-settings__row--warn b {
  color: var(--rd-rust);
}
.rd-settings__arrow {
  flex: none;
  color: var(--rd-ochre);
}
.rd-settings__rule {
  margin: var(--rd-space-s) 0;
  border: 0;
  border-top: 1px solid rgba(51, 45, 43, 0.16);
}
.rd-settings__form {
  margin: 0;
}
.rd-settings__unsub {
  margin-top: var(--rd-space-xl);
  height: 46px;
  padding: 0 24px;
  font-size: 10.5px;
  background: transparent;
  box-shadow: inset 0 0 0 1px var(--rd-ink);
  color: var(--rd-ink);
}
.rd-settings__unsub-form {
  display: inline-block;
  margin: 0;
}
.rd-settings__note {
  margin-top: var(--rd-space-m);
  max-width: 30ch;
  font-family: var(--rd-serif);
  font-style: italic;
  font-size: 16px;
  line-height: 1.25;
  color: var(--rd-ink-muted);
  text-wrap: pretty;
}

/* ---------- Courses tab (screen 09's third tab) ----------
   The hand-off has no screen for this tab, so it uses the language of the two that exist:
   hairline rows like Badges and Settings, with the course name in serif, the next action
   in small caps and one fine ochre line for progress. The photographic card
   (Cards::CurrentCourseCardComponent) stays on Home and Explore/OM Basics and is untouched. */
.rd-profile__courses {
  margin-bottom: var(--rd-space-l);
}
.rd-profile__course-list {
  margin-top: var(--rd-space-l);
}
.rd-profile__course-row {
  display: block;
  padding: var(--rd-space-m) 0 var(--rd-space-s);
  border-top: 1px solid rgba(51, 45, 43, 0.16);
  color: inherit;
  text-decoration: none;
}
.rd-profile__course-row:first-child {
  border-top: 0;
  padding-top: 0;
}
.rd-profile__course-row:focus-visible {
  outline: 2px solid var(--rd-accent);
  outline-offset: 4px;
}
.rd-profile__course-name {
  display: block;
  font-family: var(--rd-serif);
  font-weight: 500;
  font-size: 23px;
  line-height: 1.1;
  text-wrap: balance;
}
.rd-profile__course-state {
  display: block;
  margin-top: var(--rd-space-2xs);
  font-family: var(--rd-sans);
  font-size: 11px;
  font-weight: 400;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--rd-ink-muted);
}
.rd-profile__course-line {
  display: block;
  margin-top: var(--rd-space-s);
  height: 1px;
  background: rgba(51, 45, 43, 0.16);
}
.rd-profile__course-line > span {
  display: block;
  height: 1px;
  background: var(--rd-accent);
}

/* ---------- Survey completion ----------
   `hide_tab_bars` is set for this whole flow, so the page owns its frame and its top gap.
   There is no screen for it; it follows the Profile panel's vocabulary. */
.rd-survey {
  min-height: 100dvh;
  padding-top: calc(env(safe-area-inset-top) + var(--rd-space-l));
}
.rd-survey .rd-page-title {
  margin-bottom: var(--rd-space-l);
}
.rd-survey__note {
  margin-top: var(--rd-space-l);
  max-width: var(--rd-measure-body);
  font-family: var(--rd-serif);
  font-size: 17.5px;
  line-height: 1.32;
  color: var(--rd-ink-reading);
  text-wrap: pretty;
}
.rd-survey__actions {
  margin-top: var(--rd-space-xl);
  display: grid;
  gap: var(--rd-space-s);
}
.rd-survey__actions .rd-pill {
  width: 100%;
}
