*,
*::before,
*::after {
  box-sizing: border-box;
}

:root {
  --font-heading: "Libre Baskerville", serif;
  --font-body: "Inter", "Helvetica Neue", Arial, sans-serif;

  --color-primary: #9b430a;
  --color-primary-hover: #883b09;
  --color-primary-soft: #e2c7b3;
  --color-primary-contrast: #f6f1eb;
  --color-primary-focus: rgb(155 67 10 / 25%);

  --color-secondary: #007f7f;
  --color-secondary-hover: #006f6f;
  --color-secondary-soft: #b2e0e0;
  --color-secondary-light: #6eddd5;
  --color-secondary-focus: rgb(0 127 127 / 20%);

  --color-page: #f3e9e0;
  --color-page-light: #fbf7f3;
  --color-page-mid: #f1e6dc;
  --color-surface: #fffaf6;
  --color-surface-strong: #ffffff;
  --color-text: #17110d;
  --color-muted: #5f534b;
  --color-muted-strong: #3d332d;
  --color-border: rgb(155 67 10 / 16%);
  --color-border-strong: rgb(155 67 10 / 28%);
  --color-shadow: rgb(61 38 22 / 10%);
  --color-shadow-strong: rgb(61 38 22 / 16%);
  --color-success: #2e8b57;
  --color-neutral: #6d757d;

  --primary: var(--color-primary);
  --primary-background: var(--color-primary);
  --primary-border: var(--color-primary);
  --primary-hover: var(--color-primary-hover);
  --primary-hover-background: var(--color-primary-hover);
  --primary-hover-border: var(--color-primary-hover);
  --primary-focus: var(--color-primary-focus);
  --primary-inverse: var(--color-primary-contrast);
  --secondary: var(--color-secondary);
  --secondary-background: var(--color-secondary);
  --secondary-border: var(--color-secondary);
  --secondary-hover: var(--color-secondary-hover);
  --secondary-hover-background: var(--color-secondary-hover);
  --secondary-hover-border: var(--color-secondary-hover);
  --secondary-focus: var(--color-secondary-focus);
  --secondary-inverse: var(--color-surface-strong);

  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 10px;
  --shadow-card: 0 8px 24px var(--color-shadow);
  --shadow-card-hover: 0 14px 32px var(--color-shadow-strong);
  --page-inline: clamp(0.875rem, 2.5vw, 1.75rem);
  --page-block: clamp(1rem, 2.2vw, 2rem);
  --content-max: 1180px;
  --narrow-max: 720px;

  color-scheme: light;
  accent-color: var(--color-primary);
}

html,
body {
  width: 100%;
  max-width: 100%;
  min-height: 100%;
  overflow-x: hidden;
}

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  margin: 0;
  color: var(--color-text);
  background-color: var(--color-page);
  background-image: linear-gradient(
    110deg,
    var(--color-page-light) 0%,
    var(--color-page-mid) 42%,
    var(--color-primary-soft) 100%
  );
  background-attachment: fixed;
  background-repeat: no-repeat;
  background-size: cover;
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.55;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='100' height='100'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.025'/%3E%3C/svg%3E");
}

a {
  color: var(--color-primary);
  text-underline-offset: 0.18em;
}

a:hover,
a:focus {
  color: var(--color-primary-hover);
}

img {
  max-width: 100%;
  height: auto;
}

h1,
h2,
h3,
h4,
h5,
h6,
.hero-title,
.section-title,
.card-title {
  margin: 0 0 0.75rem;
  color: var(--color-text);
  font-family: var(--font-heading);
  font-variant-caps: small-caps;
  font-weight: 700;
  line-height: 1.12;
}

h1 {
  font-size: clamp(1.75rem, 3vw, 2.4rem);
}

h2 {
  margin-top: 1.25rem;
  font-size: clamp(1.35rem, 2.2vw, 1.75rem);
}

h3 {
  margin-top: 1rem;
  font-size: 1.1rem;
}

p {
  max-width: 65ch;
  margin: 0 0 1rem;
}

small {
  color: var(--color-muted);
}

nav.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  color: var(--primary-inverse);
  background-color: var(--primary-background);
  box-shadow: 0 1px 0 var(--color-border);
}

nav.topbar .nav-inner {
  width: min(100%, var(--content-max));
  margin: 0 auto;
  padding: 0.45rem var(--page-inline);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

.nav-left,
.nav-right,
nav.topbar ul {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.nav-right {
  flex-wrap: wrap;
  justify-content: flex-end;
  row-gap: 0.25rem;
}

nav.topbar ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

nav.topbar li {
  list-style: none;
  margin: 0;
  padding: 0;
}

nav.topbar a,
nav.topbar a:visited,
nav.topbar strong,
nav.topbar span,
nav.topbar .link-button {
  color: var(--primary-inverse);
  text-decoration: none;
}

nav.topbar a,
nav.topbar .link-button {
  min-height: 2rem;
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.4rem;
  border-radius: var(--radius-sm);
  white-space: nowrap;
}

nav.topbar a:hover,
nav.topbar a:focus,
nav.topbar .link-button:hover,
nav.topbar .link-button:focus {
  background-color: rgb(255 255 255 / 12%);
  color: var(--primary-inverse);
}

nav.topbar img {
  display: block;
  width: auto;
  height: 40px;
}

.main {
  flex: 1;
  width: min(100%, calc(var(--content-max) + (var(--page-inline) * 2)));
  margin: 0 auto;
  padding: var(--page-block) var(--page-inline);
}

.main > * {
  margin-bottom: 1.5rem;
}

.container,
.page-shell {
  width: 100%;
  max-width: var(--content-max);
  margin-inline: auto;
}

.page-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

.page-header h1,
.page-header h2 {
  margin-bottom: 0;
}

.page-actions,
.action-bar,
.table-actions {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  flex-wrap: wrap;
}

.action-bar {
  margin-bottom: 1rem;
}

.table-actions form,
.action-bar form {
  display: contents;
}

.card,
.page-form-card,
.content-card,
.workout-detail {
  width: 100%;
  padding: clamp(1rem, 2.5vw, 1.5rem);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  background: var(--color-surface);
  color: var(--color-text);
  box-shadow: var(--shadow-card);
}

.card > :last-child,
.page-form-card > :last-child,
.content-card > :last-child,
.workout-detail > :last-child {
  margin-bottom: 0;
}

.card--center {
  text-align: center;
}

.card--narrow,
.page-form-card {
  max-width: 40rem;
  margin-inline: auto;
}

.card--compact {
  max-width: 32rem;
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 17rem), 1fr));
  gap: 1rem;
}

.page-form-wrapper,
.centered-page {
  width: 100%;
  min-height: min(70vh, 42rem);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-block: clamp(1rem, 5vw, 3rem);
}

.centered-page {
  align-items: center;
}

.page-form {
  width: 100%;
  margin: 0;
}

.page-form header,
.page-form-card header,
.content-card header {
  margin-bottom: 1rem;
}

.page-form label,
.form-field {
  display: block;
  width: 100%;
  margin-bottom: 1rem;
  color: var(--color-muted-strong);
  font-size: 0.95rem;
  font-weight: 600;
}

input,
select,
textarea {
  width: 100%;
  min-height: 2.75rem;
  margin-top: 0.25rem;
  padding: 0.65rem 0.75rem;
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius-sm);
  background-color: var(--color-surface-strong);
  color: var(--color-text);
  font-family: inherit;
  font-size: 1rem;
}

textarea {
  min-height: 9rem;
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  outline: 3px solid var(--primary-focus);
  border-color: var(--primary-border);
}

.errorlist {
  margin: 0.5rem 0 1rem;
  padding: 0.75rem 1rem;
  border: 1px solid var(--color-border-strong);
  border-left: 4px solid var(--color-primary);
  border-radius: var(--radius-md);
  background: var(--color-surface-strong);
  color: var(--color-primary-hover);
  list-style-position: inside;
}

.btn {
  min-height: 2.35rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  padding: 0.55rem 0.85rem;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  cursor: pointer;
  color: var(--color-text);
  font: inherit;
  font-weight: 600;
  line-height: 1.1;
  text-align: center;
  text-decoration: none;
  transition:
    background-color 0.15s ease,
    border-color 0.15s ease,
    box-shadow 0.15s ease,
    color 0.15s ease,
    transform 0.15s ease;
}

.btn:hover,
.btn:focus {
  text-decoration: none;
}

.btn-primary {
  background-color: var(--primary-background);
  border-color: var(--primary-border);
  color: var(--primary-inverse);
}

.btn-primary:hover,
.btn-primary:focus {
  background-color: var(--primary-hover-background);
  border-color: var(--primary-hover-border);
  color: var(--primary-inverse);
  box-shadow: 0 0 0 3px var(--primary-focus);
}

.btn-secondary {
  background-color: var(--secondary-background);
  border-color: var(--secondary-border);
  color: var(--secondary-inverse);
}

.btn-secondary:hover,
.btn-secondary:focus {
  background-color: var(--secondary-hover-background);
  border-color: var(--secondary-hover-border);
  color: var(--secondary-inverse);
  box-shadow: 0 0 0 3px var(--secondary-focus);
}

.link-button {
  border: 0;
  background: transparent;
  color: inherit;
  padding: 0;
  font: inherit;
  cursor: pointer;
}

.link-button:hover,
.link-button:focus {
  text-decoration: underline;
}

.table-card,
.table-scroll {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  background: var(--color-surface);
  box-shadow: var(--shadow-card);
}

.table-scroll {
  margin-bottom: 1.25rem;
}

table {
  width: 100%;
  border-collapse: collapse;
  border-spacing: 0;
  background: var(--color-surface-strong);
  color: var(--color-text);
}

.table-scroll table,
.table-card table {
  min-width: 760px;
  margin: 0;
  box-shadow: none;
}

.table-scroll table.table-profile {
  min-width: 0;
}

thead {
  background-color: var(--primary-background);
}

th,
td {
  padding: 0.75rem;
  border: 0;
  border-bottom: 1px solid var(--color-border);
  vertical-align: top;
}

th {
  color: var(--primary-inverse);
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-align: left;
  text-transform: uppercase;
}

tbody tr:last-child td {
  border-bottom: 0;
}

tbody tr:nth-child(even) {
  background: rgb(155 67 10 / 3%);
}

td.actions,
th.actions {
  min-width: 13rem;
}

.table-profile th {
  width: 12rem;
  background: var(--color-primary);
}

.table-profile td {
  background: var(--color-surface-strong);
}

.table-profile p {
  max-width: none;
}

.row-muted {
  opacity: 0.55;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 1.5rem;
  padding: 0.25rem 0.65rem;
  border: 1px solid var(--color-border-strong);
  border-radius: 999px;
  background-color: var(--color-surface-strong);
  color: var(--color-secondary);
  font-size: 0.72rem;
  font-weight: 700;
  line-height: 1;
  text-transform: uppercase;
}

.status-pill.active {
  color: var(--color-success);
  border-color: var(--color-success);
}

.status-pill.completed,
.status-pill.open {
  color: var(--color-secondary);
  border-color: var(--color-secondary);
}

.status-pill.closed {
  color: var(--color-neutral);
  border-color: var(--color-neutral);
}

.status-pill.incomplete {
  color: var(--color-primary);
  border-color: var(--color-primary);
}

.td-workout {
  min-width: 9rem;
  text-align: center;
  vertical-align: middle;
}

.span-workout {
  text-align: center;
  justify-content: center;
  vertical-align: middle;
}

.workout-comments,
.workout-rpe,
.workout-completion-comment {
  color: var(--color-secondary);
  background-color: var(--color-surface-strong);
  padding: 0.15rem;
  margin: 0.15rem;
}

.workout-description,
.workout-name {
  background-color: var(--color-surface-strong);
  padding: 0.15rem;
  margin: 0.15rem;
}

.workout-name {
  margin-bottom: 0.4rem;
  color: var(--color-text);
  font-size: 1rem;
  font-weight: 700;
}

.workout-description {
  color: var(--color-muted);
  font-size: 0.85rem;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  overflow: hidden;
}

.workout-item {
  display: block;
  margin: 0.4rem 0;
  padding: 0.75rem;
  border: 2px solid var(--secondary-border);
  border-radius: var(--radius-md);
  background: var(--color-surface-strong);
  box-shadow: 0 4px 12px var(--color-shadow);
  color: inherit;
  text-decoration: none;
  cursor: pointer;
  transition:
    transform 0.15s ease,
    box-shadow 0.15s ease,
    border-color 0.15s ease;
}

.workout-item:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-card-hover);
}

.workout-item:active {
  transform: translateY(0);
}

.workout-item:focus-visible {
  outline: 3px solid var(--secondary-focus);
  outline-offset: 3px;
}

.workout-detail {
  margin: 0 0 1rem;
  border-left: 4px solid var(--secondary-border);
}

.workout-detail h2,
.workout-detail h3 {
  margin-top: 0;
}

.workout-detail-description {
  color: var(--color-text);
  line-height: 1.65;
}

.workout-detail-description p {
  max-width: none;
  margin: 0 0 0.75rem;
}

.workout-detail-description p:last-child {
  margin-bottom: 0;
}

.plan-table,
table.plan-table {
  min-width: 900px;
}

.plan-table th,
table.plan-table th {
  text-align: center;
  vertical-align: middle;
}

.plan-week-number {
  text-align: center;
  vertical-align: middle;
  white-space: nowrap;
}

.plan-week-status-cell {
  text-align: center;
  vertical-align: middle;
}

.plan-week-status {
  font-weight: 700;
  text-transform: uppercase;
}

.banner-header {
  position: relative;
  width: 100%;
  height: clamp(160px, 25vh, 260px);
  overflow: hidden;
  border-radius: var(--radius-lg);
}

.banner-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.banner-header::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to bottom,
    rgb(155 67 10 / 10%),
    rgb(155 67 10 / 30%)
  );
}

.banner-title {
  position: absolute;
  bottom: 1rem;
  left: 1.5rem;
  z-index: 1;
  margin: 0;
  color: var(--primary-inverse);
  font-size: clamp(1.5rem, 2.5vw, 2.5rem);
  font-weight: 700;
  line-height: 1.2;
}

.hero {
  position: relative;
  height: clamp(260px, 42vh, 460px);
  overflow: hidden;
  margin: calc(-1 * var(--page-block)) calc(-1 * var(--page-inline)) 2rem;
}

.hero-overlay {
  position: absolute;
  inset: 0;
  z-index: 1;
  background: linear-gradient(
    rgb(155 67 10 / 35%),
    rgb(155 67 10 / 12%)
  );
}

.hero-content {
  position: relative;
  z-index: 2;
  width: 100%;
  height: 100%;
}

.hero-logo {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.coach-pitch {
  max-width: 680px;
  margin: 3.5rem auto 3rem;
  padding: clamp(1.25rem, 3vw, 2rem);
  border-top: 1px solid var(--color-border);
  border-bottom: 1px solid var(--color-border);
  text-align: center;
  font-size: 1.08rem;
  line-height: 1.75;
  font-weight: 500;
}

.coach-pitch p {
  margin-inline: auto;
}

.coach-pitch p:first-of-type,
.coach-pitch p:last-of-type {
  color: var(--color-muted-strong);
  font-weight: 700;
}

.testimonials-section {
  max-width: 880px;
  margin: 4rem auto;
  text-align: center;
}

.testimonials-table {
  width: 100%;
  max-width: 840px;
  margin: 2rem auto;
  border-collapse: separate;
  border-spacing: 0 0.8rem;
  background: transparent;
}

.testimonials-table tbody tr {
  background: transparent;
}

.testimonials-table td {
  border: 0;
  background: var(--color-surface);
  box-shadow: var(--shadow-card);
}

.testimonials-table tbody tr td:first-child {
  width: 7rem;
  border-top-left-radius: var(--radius-lg);
  border-bottom-left-radius: var(--radius-lg);
  color: var(--color-primary);
  font-weight: 700;
  text-align: center;
}

.testimonials-table tbody tr td:last-child {
  border-top-right-radius: var(--radius-lg);
  border-bottom-right-radius: var(--radius-lg);
  text-align: left;
}

.testimonials-item-author {
  display: inline-block;
  margin-top: 0.5rem;
  color: var(--color-muted-strong);
  font-weight: 700;
}

.testimonial-featured {
  font-size: 1.05rem;
  font-weight: 600;
}

.cta-section {
  max-width: 700px;
  margin: 4rem auto 5rem;
  padding: clamp(1.25rem, 3vw, 2rem);
  border-radius: var(--radius-lg);
  background: var(--color-surface);
  box-shadow: var(--shadow-card);
  text-align: center;
}

.cta-section h2 {
  margin-top: 0;
  margin-bottom: 1rem;
}

.cta-section p {
  margin: 0 auto 1.5rem;
  color: var(--color-muted);
}

.legal-page {
  padding: clamp(1rem, 4vw, 3rem) 0;
}

.legal-page .container {
  max-width: 820px;
  margin: 0 auto;
  padding: clamp(1rem, 3vw, 2rem);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  background: var(--color-surface);
  box-shadow: var(--shadow-card);
}

.legal-page h1 {
  margin-bottom: 1rem;
}

.legal-page h2 {
  margin-top: 2rem;
  margin-bottom: 0.75rem;
}

.legal-page p,
.legal-page li {
  line-height: 1.65;
}

.legal-page ul {
  margin: 0 0 1rem 1.5rem;
}

.site-footer {
  margin-top: auto;
  padding: 1.25rem var(--page-inline);
  border-top: 1px solid var(--color-border);
  background: rgb(255 250 246 / 70%);
  color: var(--color-muted-strong);
  font-size: 0.76rem;
}

.footer-content {
  width: 100%;
  max-width: 680px;
  margin: 0 auto;
  text-align: center;
}

.site-footer p {
  max-width: 62ch;
  margin: 0.35rem auto;
  line-height: 1.45;
}

.site-footer strong {
  font-weight: 700;
}

.footer-links {
  margin-top: 0.75rem;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.35rem;
  flex-wrap: wrap;
  font-size: 0.76rem;
}

.footer-links a {
  color: var(--color-primary);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.footer-links a:hover,
.footer-links a:focus {
  color: var(--color-primary-hover);
  text-decoration-thickness: 2px;
}

.footer-links span {
  color: var(--color-muted);
}

@media (max-width: 900px) {
  nav.topbar {
    overflow-x: auto;
  }

  nav.topbar .nav-inner {
    width: max-content;
    min-width: 100%;
    justify-content: flex-start;
  }

  .nav-left,
  .nav-right,
  .nav-links,
  .nav-auth {
    flex: 0 0 auto;
    flex-wrap: nowrap;
  }

  .nav-auth span {
    display: none;
  }

  nav.topbar img {
    height: 34px;
  }

  .page-header {
    align-items: flex-start;
    flex-direction: column;
  }
}

@media (max-width: 768px) {
  body {
    background-attachment: scroll;
  }

  .main {
    padding: 0.875rem;
  }

  .hero {
    height: clamp(220px, 34vh, 340px);
    margin: -0.875rem -0.875rem 1.5rem;
  }

  .card,
  .page-form-card,
  .content-card,
  .workout-detail {
    border-radius: var(--radius-md);
  }

  .page-form-wrapper,
  .centered-page {
    min-height: auto;
    padding-block: 0.75rem;
  }

  .action-bar,
  .page-actions,
  .table-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .action-bar .btn,
  .page-actions .btn,
  .table-actions .btn,
  .table-actions button,
  .page-form button {
    width: 100%;
  }

  .table-card,
  .table-scroll {
    margin-inline: -0.125rem;
  }

  th,
  td {
    padding: 0.65rem;
  }

  .table-profile,
  .table-profile tbody,
  .table-profile tr,
  .table-profile th,
  .table-profile td {
    display: block;
    width: 100%;
  }

  .table-profile th {
    border-bottom: 0;
  }

  .table-profile td {
    border-bottom: 1px solid var(--color-border);
  }

  .workout-item {
    min-width: 110px;
    padding: 0.55rem;
  }

  .coach-pitch {
    margin: 2rem auto;
    font-size: 1rem;
  }

  .testimonials-table,
  .testimonials-table tbody,
  .testimonials-table tr,
  .testimonials-table td {
    display: block;
    width: 100%;
  }

  .testimonials-table {
    border-spacing: 0;
  }

  .testimonials-table tr {
    margin-bottom: 1rem;
    border-radius: var(--radius-lg);
    background: var(--color-surface);
    box-shadow: var(--shadow-card);
  }

  .testimonials-table td {
    box-shadow: none;
  }

  .testimonials-table tbody tr td:first-child,
  .testimonials-table tbody tr td:last-child {
    border-radius: 0;
    text-align: center;
  }

  .testimonials-table tbody tr td:first-child {
    border-top-left-radius: var(--radius-lg);
    border-top-right-radius: var(--radius-lg);
  }

  .testimonials-table tbody tr td:last-child {
    border-bottom-right-radius: var(--radius-lg);
    border-bottom-left-radius: var(--radius-lg);
  }
}

@media (max-width: 520px) {
  .btn {
    width: 100%;
  }

  nav.topbar a,
  nav.topbar .link-button {
    padding-inline: 0.35rem;
    font-size: 0.92rem;
  }

  .footer-links {
    align-items: center;
    flex-direction: column;
  }

  .footer-links span {
    display: none;
  }
}
