:root {
  color-scheme: light;
  --ink: #171a18;
  --muted: #565d58;
  --line: #dfe4df;
  --soft: #f5f7f5;
  --sage: #A2C3A4;
  --sage-deep: #869D96;
  --sage-pale: #e9f1e9;
  --white: #fff;
  --radius: 17px;
  font: 16px/1.55 -apple-system, BlinkMacSystemFont, "Helvetica Neue", system-ui, sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--white); color: var(--ink); }
h1, h2, h3, p { margin: 0; }
h1, h2, h3 { line-height: 1.08; letter-spacing: -.045em; }
h1 { font-size: clamp(2.8rem, 7vw, 5.25rem); font-weight: 650; }
h2 { font-size: clamp(1.42rem, 3.1vw, 2.1rem); font-weight: 650; }
h3 { font-size: 1.17rem; font-weight: 650; }
p { color: var(--muted); }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
a { color: inherit; text-underline-offset: 4px; }
a, button, input, select, textarea { -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; }
.greeting-name { color: var(--sage); }
.page-width { width: min(1120px, calc(100% - 64px)); margin-inline: auto; }
.startup { min-height: 65vh; display: grid; align-content: center; justify-items: center; gap: 12px; }

.site-header { border-bottom: 1px solid var(--line); }
.header-inner {
  width: min(1120px, calc(100% - 64px)); margin: auto; min-height: 76px;
  display: flex; align-items: center; justify-content: space-between; gap: 20px;
}
.brand { text-decoration: none; display: inline-flex; align-items: center; min-height: 44px; }
.wordmark { display: block; position: relative; width: 6.8rem; aspect-ratio: 1863 / 525; overflow: hidden; }
.wordmark::before, .wordmark::after {
  content: "";
  position: absolute;
  width: calc(100% * 2720 / 1863);
  aspect-ratio: 2720 / 1120;
  left: calc(-100% * 381 / 1863);
  top: calc(-100% * 295 / 525);
  background: url("./assets/flowjo_logo_two_fonts_new_colour.png") center / 100% 100% no-repeat;
}
/* Split the image in the gap between letters, then match the two o heights. */
.wordmark::before { clip-path: inset(0 36.32% 0 0); }
.wordmark::after {
  clip-path: inset(0 0 0 63.68%);
  transform-origin: 64.15% 63.04%;
  transform: translateY(.18%) scale(1.1066);
}
.main-nav { display: flex; align-items: center; gap: 6px; }
.main-nav a {
  display: inline-flex; gap: 6px; align-items: center; justify-content: center;
  text-decoration: none; padding: 9px 13px; border-radius: 9px; font-size: .94rem; font-weight: 550; white-space: nowrap;
}
.main-nav a[aria-current="page"], .main-nav a:hover { background: var(--soft); }
.main-nav .nav-create { background: var(--sage); }
.main-nav .nav-create:hover, .main-nav .nav-create[aria-current="page"] { background: var(--sage-deep); }

.button {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 44px; padding: 9px 16px; border: 1px solid transparent; border-radius: 9px;
  color: var(--ink); background: var(--white); text-decoration: none; font-weight: 650; font-size: .94rem; line-height: 1.25;
}
.button:hover { background: var(--soft); }
.primary { background: var(--sage); }
.primary:hover { background: var(--sage-deep); }
.secondary { border-color: var(--line); }
.accent-secondary { background: var(--sage-deep); }
.accent-secondary:hover { background: var(--sage); }
.text-button { background: transparent; }
.button-row { display: flex; flex-wrap: wrap; align-items: center; gap: 9px; }

.welcome { min-height: min(700px, calc(100vh - 76px)); display: grid; grid-template-columns: 1.05fr 1fr; align-items: center; gap: clamp(25px, 7vw, 100px); padding-block: 72px; }
.welcome h1 { max-width: 10ch; }
.welcome em { font-family: Georgia, serif; font-weight: 400; font-style: italic; letter-spacing: -.066em; }
.welcome-copy > p { max-width: 440px; margin-block: 20px 26px; font-size: 1.12rem; }
.preview { padding: clamp(20px, 4vw, 36px); background: var(--ink); color: var(--white); border-radius: 23px; }
.preview-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 22px; }
.preview-header h2 { margin-top: 8px; }
.preview-label { color: var(--sage); font-size: .88rem; font-weight: 650; }
.preview-time { background: var(--sage); color: var(--ink); padding: 4px 9px; border-radius: 5px; white-space: nowrap; font-size: .81rem; font-weight: 650; }
.preview-sequence, .flow-list, .set-list { list-style: none; margin: 0; padding: 0; }
.preview-sequence li { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 11px 0; border-top: 1px solid #414741; }
.preview-sequence .exercise-row-main { align-items: center; }
.preview-set-time { color: #d1ded3; white-space: nowrap; font-variant-numeric: tabular-nums; }
.preview-reference, .preview-summary { display: block; color: #d1ded3; font-size: .86rem; }
.preview-summary { margin-top: 4px; }

.centered { max-width: 550px; padding-block: clamp(55px, 12vh, 138px); }
.centered h1 { font-size: clamp(2.6rem, 6vw, 4.25rem); }
.login-panel > p { margin-block: 16px 21px; }
.onboarding { max-width: 590px; padding-top: clamp(35px, 8vh, 78px); }
.onboarding-top { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 8px; }
.back-button { margin-left: -12px; padding-inline: 12px; }
.secondary-text { color: var(--muted); font-size: .9rem; }
.progress-track { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin-bottom: clamp(26px, 6vh, 49px); }
.progress-track span { height: 4px; border-radius: 5px; background: var(--line); }
.progress-track .complete { background: var(--sage-deep); }
.onboarding h1 { margin-bottom: 24px; }
.onboarding-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 24px; }
.onboarding-actions .primary { min-width: 100px; }
.field { display: grid; gap: 6px; font-size: .92rem; font-weight: 600; min-width: 0; }
input:not([type="checkbox"]), select, textarea {
  width: 100%; padding: 10px 12px; border: 1px solid #cdd4ce; border-radius: 9px;
  background: var(--white); color: var(--ink); font-size: 1rem; font-weight: 400; min-height: 45px;
}
input::placeholder, textarea::placeholder { color: #666e67; opacity: 1; }
select {
  appearance: none; padding-right: 32px;
  background-image: linear-gradient(45deg, transparent 50%, var(--ink) 50%), linear-gradient(135deg, var(--ink) 50%, transparent 50%);
  background-position: calc(100% - 15px) 52%, calc(100% - 10px) 52%; background-size: 5px 5px; background-repeat: no-repeat;
}
textarea { min-height: 110px; resize: vertical; }
.voice-field { position: relative; margin-top: 6px; }
.voice-field textarea { min-height: 142px; padding-bottom: 51px; display: block; }
.mic-button { position: absolute; right: 8px; bottom: 8px; background: var(--sage-pale); }
.icon-button { width: 44px; padding: 0; }
.mic { display: block; position: relative; width: 15px; height: 15px; border: 1.5px solid currentColor; border-top: 0; border-radius: 0 0 10px 10px; }
.mic::before { content: ""; position: absolute; width: 6px; height: 12px; top: -4px; left: 3px; border: 1.5px solid currentColor; border-radius: 7px; }
.mic::after { content: ""; position: absolute; bottom: -5px; left: 6px; width: 1.5px; height: 4px; background: currentColor; }
.field-feedback:not(:empty) { margin-top: 6px; color: var(--muted); font-size: .89rem; }
.goal-options { border: 0; margin: 0; padding: 0; display: grid; gap: 7px; }
.goal-option, .check-field { display: flex; align-items: center; gap: 9px; min-height: 44px; }
.goal-option { border: 1px solid var(--line); background: var(--white); border-radius: 9px; padding: 9px 12px; }
.goal-option:has(input:checked) { border-color: var(--sage-deep); background: var(--sage-pale); }
input[type="checkbox"] { accent-color: #465c4d; width: 17px; height: 17px; margin: 0; flex-shrink: 0; }

.workspace { padding-block: clamp(29px, 6vw, 67px) 76px; }
.page-heading { margin-bottom: 26px; }
.page-heading h1, .home-hero h1 { font-size: clamp(2.5rem, 6vw, 4.15rem); }
.page-heading p, .home-hero p { margin-top: 9px; }
.home-hero {
  background: var(--soft); padding: clamp(21px, 5vw, 55px); border-radius: 22px;
  display: flex; align-items: flex-end; justify-content: space-between; flex-wrap: wrap; gap: 18px;
}
.workspace-section { margin-top: 34px; }
.section-heading { display: flex; align-items: center; flex-wrap: wrap; justify-content: space-between; gap: 12px; }
.empty-state { margin-top: 12px; padding: 20px; border: 1px solid var(--line); border-radius: var(--radius); }
.subtle-link { margin-top: 13px; display: inline-block; color: var(--muted); }
.flow-list { display: grid; gap: 8px; margin-top: 12px; }
.saved-flow {
  width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 10px;
  text-align: left; background: var(--white); border: 1px solid var(--line); padding: 13px 16px; border-radius: 11px; color: var(--ink);
}
.saved-flow:hover { background: var(--soft); }
.saved-flow strong, .saved-flow small { display: block; overflow-wrap: anywhere; }
.saved-flow small { color: var(--muted); font-size: .86rem; }
.saved-flow-meta { display: flex; align-items: center; gap: 11px; color: var(--muted); font-size: .87rem; white-space: nowrap; }
.edit-chip, .setup-label { display: inline-block; border-radius: 5px; font-weight: 650; font-size: .81rem; padding: 3px 7px; }
.edit-chip { background: var(--sage); color: var(--ink); }
.setup-label { background: var(--soft); color: var(--muted); margin-top: 5px; }

.planner-layout { display: grid; grid-template-columns: minmax(0, .72fr) minmax(0, 1.28fr); gap: clamp(18px, 4vw, 46px); align-items: start; }
.planner-brief { padding: 18px; border: 1px solid var(--line); border-radius: var(--radius); }
.planner-brief > h2, .profile-section > h2 { margin-bottom: 13px; }
.planner-brief form, .profile-section { display: grid; gap: 13px; }
.class-format-summary { padding: 10px; border-radius: 8px; background: var(--soft); font-size: .9rem; }
.class-format-summary p { margin-top: 3px; }
.class-format-summary details { margin-top: 5px; }
.class-format-summary summary { cursor: pointer; min-height: 28px; width: fit-content; }
.class-format-summary ul { margin: 6px 0; padding-inline-start: 20px; color: var(--muted); }
.check-group { display: flex; flex-wrap: wrap; gap: 0 13px; }
.check-field { font-size: .91rem; }
.remembered { font-size: .9rem; margin-top: 13px; padding: 9px; background: var(--sage-pale); border-radius: 7px; }
.plan-note { font-size: .89rem; margin-top: 6px; }
.plan-time { margin-top: 10px; color: var(--ink); font-size: .93rem; font-weight: 650; }
.plan-time:empty { display: none; }
.plan-edit-form { display: grid; gap: 8px; margin-top: 12px; padding: 12px; border-radius: 8px; background: var(--soft); }
.plan-edit-form textarea { min-height: 74px; }
.plan-edit-form .button { justify-self: start; }
.plan-focus { margin-top: 10px; font-size: .9rem; overflow-wrap: anywhere; }
.library-panel { margin-top: 12px; padding: 14px; border: 1px solid var(--line); border-radius: var(--radius); }
.library-panel .section-heading { gap: 6px; }
.library-tabs { margin: 10px 0 13px; }
.library-tabs .button { padding-inline: 11px; }
.library-tabs [aria-pressed="true"] { background: var(--sage); border-color: var(--sage); }
.library-count, .library-feedback { margin-top: 8px; font-size: .88rem; }
.library-feedback:empty { display: none; }
.library-feedback { color: var(--ink); font-weight: 650; }
.library-list { list-style: none; margin: 7px 0 0; padding: 0 4px 0 0; max-height: 26rem; overflow: auto; }
.library-list li { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 12px; padding: 9px 4px; border-top: 1px solid var(--line); }
.library-list strong, .library-list small { display: block; overflow-wrap: anywhere; }
.library-list small { color: var(--muted); font-size: .86rem; }
.library-add { padding-inline: 12px; }
.exercise-row-main { display: flex; align-items: flex-start; gap: 10px; min-width: 0; }
.exercise-row-text { min-width: 0; }
.exercise-thumbnail {
  --image-max-height: 3.6rem;
  display: grid; flex: none; place-items: center; overflow: hidden;
  width: 5.4rem; height: calc(var(--image-max-height) + 2px); padding: 0;
  border: 1px solid var(--line); border-radius: 8px; background: var(--white);
}
.exercise-thumbnail:hover { border-color: var(--sage-deep); }
.exercise-image {
  display: block; position: relative; overflow: hidden;
  width: min(100%, calc(var(--image-ratio) * var(--image-max-height)));
  aspect-ratio: var(--image-ratio);
}
.exercise-image img { display: block; position: absolute; height: auto; max-width: none; }
.image-reference { display: block; color: var(--muted); font-size: .81rem; }
.exercise-preview {
  --image-max-height: 65vh;
  width: min(620px, calc(100% - 24px)); max-height: calc(100vh - 24px);
  padding: clamp(14px, 4vw, 24px); border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--white); color: var(--ink);
}
.exercise-preview::backdrop { background: rgb(23 26 24 / 45%); }
.exercise-preview .exercise-image { margin: 14px auto; }
.exercise-preview .exercise-image-source { margin-top: 5px; font-size: .86rem; }
.set-list { display: grid; gap: 7px; margin-top: 12px; }
.set-row {
  --remove-size: 32px;
  position: relative; display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 8px; align-items: start;
  padding: 11px calc(var(--remove-size) + 8px) 11px 10px; border: 1px solid var(--line); border-radius: 10px;
}
.set-row.drop-before { box-shadow: 0 -3px 0 var(--sage-deep); }
.set-row.drop-after { box-shadow: 0 3px 0 var(--sage-deep); }
.drag-handle {
  cursor: grab; display: grid; place-items: center; width: 25px; min-height: 36px;
  padding: 0; border: 0; border-radius: 6px; background: transparent; color: var(--muted);
  font-size: 1.3rem; user-select: none; touch-action: none;
}
.drag-handle:active { cursor: grabbing; }
.remove-button {
  position: absolute; inset-block-start: 4px; inset-inline-end: 4px; display: grid; place-items: center;
  width: var(--remove-size); height: var(--remove-size); padding: 0; border: 0; border-radius: 6px;
  background: transparent; color: var(--muted); font-size: 1.15rem; line-height: 1;
}
.remove-button:hover, .drag-handle:hover { color: var(--ink); background: var(--soft); }
.set-heading { display: flex; flex-wrap: wrap; align-items: baseline; gap: 1px 7px; }
.set-time { color: var(--muted); font-size: .86rem; white-space: nowrap; }
.set-time input { width: 3.5rem; min-height: 32px; padding: 2px 4px; font-size: .86rem; }
.set-copy p { font-size: .9rem; margin-top: 2px; }
.set-exercises {
  list-style: none; padding: 0; margin: 9px 0 0; display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 165px), 1fr)); gap: 7px;
}
.set-exercises li { display: flex; gap: 8px; align-items: center; min-width: 0; }
.set-exercises li > div { min-width: 0; overflow-wrap: anywhere; font-size: .86rem; line-height: 1.35; }
.set-exercises .removable-exercise { position: relative; padding-inline-end: var(--remove-size); }
.removable-exercise .remove-button { inset-block-start: 0; inset-inline-end: 0; }
.planner-actions, .learning-panel { margin-top: 12px; }
.learning-panel { padding: 12px; background: var(--sage-pale); border-radius: 10px; }
.learning-panel p { margin-bottom: 8px; }
.profile-form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
.profile-section { align-content: start; padding: 18px; border: 1px solid var(--line); border-radius: var(--radius); }
.profile-form > .button-row { grid-column: 1 / -1; }

.status-message, .storage-message {
  position: fixed; z-index: 2; max-width: min(460px, calc(100% - 28px)); right: 14px; bottom: 14px;
  padding: 10px 10px 10px 13px; border-radius: 9px; border: 1px solid var(--line);
  background: var(--sage-pale); color: var(--ink); font-size: .91rem;
}
.status-close { background: transparent; color: var(--ink); border: 0; border-radius: 5px; font-size: 1.2rem; padding: 0 7px; }
.storage-message { left: 14px; right: auto; }

@media (max-width: 780px) {
  .page-width, .header-inner { width: calc(100% - 32px); }
  .welcome { gap: 22px; }
  .planner-layout { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 590px) {
  body:has(.main-nav) { padding-bottom: calc(59px + env(safe-area-inset-bottom)); }
  .header-inner { min-height: 61px; }
  .main-nav {
    position: fixed; z-index: 1; inset: auto 0 0; padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
    display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 3px;
    border-top: 1px solid var(--line); background: var(--white);
  }
  .main-nav a { font-size: .78rem; padding: 5px 4px; min-height: 45px; }
  .main-nav a span { font-size: .86rem; }
  .welcome { min-height: auto; grid-template-columns: minmax(0, 1fr); padding-block: 39px; }
  .welcome-copy > p { margin-block: 15px 19px; }
  .preview { border-radius: 16px; }
  .profile-form { grid-template-columns: minmax(0, 1fr); }
  .exercise-thumbnail { --image-max-height: 3.3rem; width: 4.4rem; }
  .exercise-row-main { gap: 7px; }
  .set-time input { min-height: 44px; font-size: 1rem; }
  .status-message, .storage-message { bottom: calc(68px + env(safe-area-inset-bottom)); }
}
@media (pointer: coarse) {
  .set-row { --remove-size: 44px; }
  .drag-handle { width: 36px; min-height: 44px; }
}
