/*
 * 6Flaschen WeinApp
 * Profile UX Redesign – Hotfix 8.4.9 Revision 9.19
 * Mobile-first, progressive disclosure, iOS-like interaction hierarchy.
 */

html.coastal-ui body.coastal-profile-page.profile-r19-page {
  --r19-bg: #f4f0e8;
  --r19-surface: rgba(255, 253, 248, 0.88);
  --r19-surface-strong: #fffdf8;
  --r19-surface-soft: rgba(246, 241, 231, 0.86);
  --r19-text: #152a34;
  --r19-muted: #637079;
  --r19-accent: #ad7d2f;
  --r19-accent-soft: rgba(181, 141, 63, 0.12);
  --r19-border: rgba(96, 83, 59, 0.15);
  --r19-border-strong: rgba(181, 141, 63, 0.30);
  --r19-positive: #225d45;
  --r19-negative: #77404a;
}

html[data-theme="dark"].coastal-ui body.coastal-profile-page.profile-r19-page {
  --r19-bg: #071c27;
  --r19-surface: rgba(10, 34, 46, 0.96);
  --r19-surface-strong: #0b2633;
  --r19-surface-soft: #102f3d;
  --r19-text: #f5efe4;
  --r19-muted: #bcc8cc;
  --r19-accent: #dfb66b;
  --r19-accent-soft: rgba(223, 182, 107, 0.10);
  --r19-border: rgba(211, 190, 148, 0.17);
  --r19-border-strong: rgba(224, 189, 118, 0.30);
  --r19-positive: #7fbd93;
  --r19-negative: #d4989f;
}

html.coastal-ui body.coastal-profile-page.profile-r19-page {
  color: var(--r19-text);
}

html.coastal-ui body.coastal-profile-page .profile-r19-flow {
  width: 100%;
  max-width: 1120px;
  margin: 0 auto;
  display: grid;
  gap: 18px;
}

html.coastal-ui body.coastal-profile-page .profile-r19-hero {
  width: 100% !important;
  max-width: 1120px !important;
  margin: 0 !important;
}

html.coastal-ui body.coastal-profile-page .profile-r19-hero-copy {
  gap: 12px !important;
}

.profile-r19-title-row {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 14px;
}

.profile-r19-title-row h1 {
  min-width: 0;
  margin: 0 !important;
}

.profile-r19-info-button,
.profile-r19-sheet-close {
  flex: 0 0 auto;
  width: 44px;
  height: 44px;
  padding: 0;
  display: grid;
  place-items: center;
  border: 1px solid var(--r19-border-strong);
  border-radius: 50%;
  background: var(--r19-accent-soft);
  color: var(--r19-accent);
  font-family: ui-serif, Georgia, serif;
  font-size: 22px;
  font-weight: 700;
  cursor: pointer;
}

.profile-r19-info-button:focus-visible,
.profile-r19-sheet-close:focus-visible,
.profile-r19-disclosure > summary:focus-visible,
.profile-r19-inline-disclosure > summary:focus-visible {
  outline: 3px solid rgba(223, 182, 107, 0.22);
  outline-offset: 3px;
}

.profile-r19-meta-details {
  width: fit-content;
  max-width: 100%;
  margin-top: 4px;
}

.profile-r19-meta-details > summary {
  list-style: none;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  color: var(--r19-muted);
  font-size: 14px;
  line-height: 1.35;
  cursor: pointer;
}
.profile-r19-meta-details > summary::-webkit-details-marker { display: none; }
.profile-r19-status-icon {
  width: 28px;
  height: 28px;
  display: inline-grid;
  place-items: center;
  border: 1px solid var(--r19-border-strong);
  border-radius: 50%;
  color: var(--r19-positive);
  background: rgba(61, 123, 89, 0.08);
  font-weight: 800;
}
.profile-r19-meta-panel {
  margin-top: 10px;
  padding: 12px 14px;
  border: 1px solid var(--r19-border);
  border-radius: 14px;
  background: var(--r19-surface-soft);
}
.profile-r19-meta-panel p { margin: 0; color: var(--r19-muted); font-size: 13px; line-height: 1.55; }

.profile-r19-card,
.profile-r19-system-state {
  box-sizing: border-box;
  width: 100%;
  border: 1px solid var(--r19-border);
  border-radius: 26px;
  background: var(--r19-surface);
  color: var(--r19-text);
  box-shadow: 0 18px 46px rgba(0, 0, 0, 0.08);
}
html[data-theme="dark"] .profile-r19-card,
html[data-theme="dark"] .profile-r19-system-state {
  box-shadow: 0 18px 46px rgba(0, 0, 0, 0.20);
}

.profile-r19-card {
  padding: clamp(22px, 3.6vw, 34px);
}
.profile-r19-card .eyebrow,
.profile-r19-sheet .eyebrow {
  color: var(--r19-accent) !important;
  letter-spacing: 0.14em;
}
.profile-r19-card > h2,
.profile-r19-sheet h2 {
  margin: 7px 0 0;
  color: var(--r19-text);
  font-family: ui-serif, Georgia, "Times New Roman", serif;
  font-size: clamp(29px, 4vw, 46px);
  font-weight: 500;
  line-height: 1.08;
}
.profile-r19-card > h3 { color: var(--r19-text); }
.profile-r19-muted { color: var(--r19-muted); line-height: 1.58; }

.profile-r19-system-state {
  padding: 13px 16px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px 10px;
  color: var(--r19-muted);
  font-size: 13px;
}
.profile-r19-system-state strong { color: var(--r19-text); }

.profile-r19-disclosure {
  padding: 0;
  overflow: hidden;
}
.profile-r19-disclosure > summary,
.profile-r19-inline-disclosure > summary {
  list-style: none;
  position: relative;
  cursor: pointer;
  color: var(--r19-accent);
  font-weight: 760;
  user-select: none;
}
.profile-r19-disclosure > summary::-webkit-details-marker,
.profile-r19-inline-disclosure > summary::-webkit-details-marker { display: none; }
.profile-r19-disclosure > summary::after,
.profile-r19-inline-disclosure > summary::after {
  content: "›";
  font-size: 1.35em;
  line-height: 1;
  transition: transform 160ms ease;
}
.profile-r19-disclosure[open] > summary::after,
.profile-r19-inline-disclosure[open] > summary::after { transform: rotate(90deg); }
.profile-r19-disclosure > summary {
  min-height: 64px;
  padding: 16px 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--r19-text);
  font-family: ui-serif, Georgia, serif;
  font-size: 22px;
  font-weight: 600;
}
.profile-r19-disclosure[open] > summary { border-bottom: 1px solid var(--r19-border); }
.profile-r19-summary-hint { margin-left: auto; color: var(--r19-muted); font-family: inherit; font-size: 13px; }
.profile-r19-disclosure-body { padding: 18px 22px 22px; }

.profile-r19-secondary-list { display: grid; gap: 8px; margin-top: 12px; }
.profile-r19-list-row {
  min-height: 58px;
  padding: 12px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border: 1px solid var(--r19-border);
  border-radius: 17px;
  background: var(--r19-surface-soft);
}
.profile-r19-list-row > div { display: grid; gap: 3px; }
.profile-r19-list-row strong { color: var(--r19-text); }
.profile-r19-list-row small { color: var(--r19-muted); }
.profile-r19-list-row > span { color: var(--r19-accent); font-size: 24px; }

.profile-r19-story-text {
  max-width: 920px;
  margin: 20px 0 0;
  color: var(--r19-muted);
  font-size: clamp(16px, 2vw, 19px);
  line-height: 1.72;
}
.profile-r19-inline-disclosure {
  margin-top: 22px;
  padding-top: 16px;
  border-top: 1px solid var(--r19-border);
}
.profile-r19-inline-disclosure > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 44px;
  font-size: 16px;
}
.profile-r19-inline-body { padding-top: 18px; }
.profile-r19-inline-body > h3 { margin: 0 0 8px; color: var(--r19-text); font-size: 20px; }
.profile-r19-inline-body > p { margin: 0; color: var(--r19-muted); line-height: 1.7; }

.profile-r19-traits { margin-top: 22px; display: grid; }
.profile-r19-trait-row {
  display: grid;
  grid-template-columns: 34px minmax(100px, 0.7fr) minmax(140px, 1.5fr) minmax(115px, auto);
  align-items: center;
  gap: 13px;
  min-height: 62px;
  border-bottom: 1px solid var(--r19-border);
}
.profile-r19-trait-row:last-child { border-bottom: 0; }
.profile-r19-trait-rank {
  width: 30px; height: 30px; display: grid; place-items: center;
  border: 1px solid var(--r19-border-strong); border-radius: 50%; color: var(--r19-accent); font-size: 13px; font-weight: 800;
}
.profile-r19-trait-row strong { color: var(--r19-text); font-size: 17px; }
.profile-r19-trait-bar { height: 7px; overflow: hidden; border-radius: 99px; background: rgba(118, 127, 128, 0.25); }
.profile-r19-trait-bar i { display: block; height: 100%; min-width: 12%; border-radius: inherit; background: linear-gradient(90deg, #b88a40, #e1bd79); }
.profile-r19-trait-label { justify-self: end; padding: 6px 10px; border: 1px solid var(--r19-border-strong); border-radius: 999px; color: var(--r19-accent); font-size: 12px; white-space: nowrap; }

.profile-r19-axis-list { display: grid; gap: 10px; }
.profile-r19-axis-list .profile-axis-row {
  margin: 0;
  padding: 14px;
  border: 1px solid var(--r19-border) !important;
  border-radius: 17px;
  background: var(--r19-surface-soft) !important;
  color: var(--r19-text);
}
.profile-r19-axis-list .profile-axis-labels strong { color: var(--r19-text); }
.profile-r19-axis-list .profile-axis-result-text { color: var(--r19-accent); }

.profile-r19-top-groups {
  margin-top: 22px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}
.profile-r19-top-group {
  padding: 16px;
  border: 1px solid var(--r19-border);
  border-radius: 20px;
  background: var(--r19-surface-soft);
}
.profile-r19-top-group h3 { margin: 0 0 10px; color: var(--r19-text); font-size: 18px; }
.profile-r19-ranked-list { list-style: none; counter-reset: rank; margin: 0; padding: 0; }
.profile-r19-ranked-list li {
  counter-increment: rank;
  min-height: 52px;
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  border-top: 1px solid var(--r19-border);
  color: var(--r19-text);
}
.profile-r19-ranked-list li::before {
  content: counter(rank);
  width: 28px; height: 28px; display: grid; place-items: center;
  border: 1px solid var(--r19-border-strong); border-radius: 50%; color: var(--r19-accent); font-size: 13px; font-weight: 800;
}
.profile-r19-ranked-list li:first-child { border-top: 0; }
.profile-r19-ranked-list li span { min-width: 0; font-weight: 700; }
.profile-r19-ranked-list li small { color: var(--r19-muted); white-space: nowrap; }

.profile-r19-full-groups { display: grid; gap: 18px; }
.profile-r19-full-group { display: grid; gap: 12px; }
.profile-r19-full-group > h3 { margin: 0; color: var(--r19-text); font-size: 21px; }
.profile-r19-full-group .profile-grape-cuvee-columns { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.profile-r19-full-group .profile-grape-cuvee-direction {
  padding: 14px;
  border: 1px solid var(--r19-border);
  border-radius: 19px;
  background: var(--r19-surface-soft);
}
.profile-r19-full-group .profile-grape-cuvee-direction.is-positive { border-color: rgba(93, 154, 112, 0.28); }
.profile-r19-full-group .profile-grape-cuvee-direction.is-negative { border-color: rgba(173, 103, 112, 0.25); }
.profile-r19-full-group .profile-grape-cuvee-direction-head { display: flex; justify-content: space-between; gap: 10px; color: var(--r19-text); font-weight: 800; }
.profile-r19-full-group .profile-grape-cuvee-list { display: grid; margin-top: 10px; }
.profile-r19-full-group .profile-grape-cuvee-item {
  padding: 13px 0;
  border: 0 !important;
  border-top: 1px solid var(--r19-border) !important;
  border-radius: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
}
.profile-r19-full-group .profile-grape-cuvee-item:first-child { border-top: 0 !important; }
.profile-r19-full-group .profile-grape-cuvee-item-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.profile-r19-full-group .profile-grape-cuvee-item-head strong { color: var(--r19-text); }
.profile-r19-full-group .profile-grape-cuvee-meta { display: flex; flex-wrap: wrap; gap: 5px 10px; margin-top: 7px; color: var(--r19-muted); font-size: 12px; }
.profile-r19-full-group .profile-grape-cuvee-item p { margin: 6px 0 0; color: var(--r19-muted); font-size: 13px; }

.profile-r19-cta-card { padding-bottom: clamp(24px, 4vw, 36px); }
.profile-r19-cta-card > p { max-width: 760px; margin: 18px 0 22px; color: var(--r19-muted); font-size: 17px; line-height: 1.65; }
.profile-r19-primary-action { min-height: 54px; padding-inline: 24px; }

.profile-r19-empty p { color: var(--r19-muted); line-height: 1.6; }

/* Bottom sheet / dialog for profile types */
.profile-r19-sheet {
  width: min(720px, calc(100vw - 28px));
  max-height: min(78vh, 780px);
  margin: auto auto 16px;
  padding: 20px;
  overflow: auto;
  border: 1px solid var(--r19-border);
  border-radius: 28px;
  background: var(--r19-surface-strong);
  color: var(--r19-text);
  box-shadow: 0 32px 90px rgba(0,0,0,.38);
}
.profile-r19-sheet::backdrop { background: rgba(2, 13, 20, 0.62); backdrop-filter: blur(7px); }
.profile-r19-sheet-handle { display: none; width: 42px; height: 5px; margin: 0 auto 14px; border-radius: 99px; background: var(--r19-border-strong); }
.profile-r19-sheet-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; }
.profile-r19-sheet-head h2 { font-size: clamp(28px, 4vw, 40px); }
.profile-r19-type-list { margin-top: 18px; display: grid; gap: 9px; }
.profile-r19-type-item { padding: 14px 15px; border: 1px solid var(--r19-border); border-radius: 18px; background: var(--r19-surface-soft); }
.profile-r19-type-item.is-current { border-color: var(--r19-border-strong); background: var(--r19-accent-soft); }
.profile-r19-type-item-head { display: flex; justify-content: space-between; gap: 10px; }
.profile-r19-type-item-head strong { color: var(--r19-text); }
.profile-r19-type-item-head span { color: var(--r19-accent); font-size: 12px; font-weight: 800; }
.profile-r19-type-item p { margin: 7px 0 0; color: var(--r19-muted); font-size: 13px; line-height: 1.5; }

@media (max-width: 760px) {
  html.coastal-ui body.coastal-profile-page .profile-r19-flow { gap: 14px; }
  .profile-r19-card { padding: 20px 18px; border-radius: 22px; }
  .profile-r19-card > h2 { font-size: clamp(28px, 8vw, 38px); }
  .profile-r19-title-row { align-items: flex-start; }
  .profile-r19-info-button { width: 42px; height: 42px; font-size: 20px; }
  .profile-r19-disclosure > summary { min-height: 58px; padding: 14px 17px; font-size: 20px; }
  .profile-r19-disclosure-body { padding: 15px 17px 18px; }
  .profile-r19-trait-row { grid-template-columns: 30px minmax(75px, .8fr) minmax(80px, 1.2fr) auto; gap: 8px; }
  .profile-r19-trait-row strong { font-size: 15px; }
  .profile-r19-trait-label { padding: 5px 7px; font-size: 10.5px; }
  .profile-r19-top-groups { grid-template-columns: 1fr; gap: 12px; }
  .profile-r19-full-group .profile-grape-cuvee-columns { grid-template-columns: 1fr; }
  .profile-r19-primary-action { width: 100%; }
  .profile-r19-sheet { width: calc(100vw - 16px); max-height: 82vh; margin: auto 8px 8px; padding: 14px; border-radius: 26px 26px 18px 18px; }
  .profile-r19-sheet-handle { display: block; }
}

@media (max-width: 480px) {
  .profile-r19-trait-row { grid-template-columns: 28px minmax(0, 1fr) auto; min-height: 66px; }
  .profile-r19-trait-bar { grid-column: 2 / -1; grid-row: 2; margin: -8px 0 9px; }
  .profile-r19-trait-label { grid-column: 3; grid-row: 1; }
  .profile-r19-ranked-list li { grid-template-columns: 32px minmax(0, 1fr); }
  .profile-r19-ranked-list li small { grid-column: 2; margin-top: -8px; }
}
