/* ==========================================================================
   Workout Writer – subpages (blog, docs, beta, privacy, terms)
   Same design tokens as main.css; dark footer to match landing.
   ========================================================================== */

:root {
  --color-aqua: #00D7B6;
  --color-aqua-dark: #03a990;
  --color-navy: #061525;
  --color-navy-deep: #08101D;
  --color-white: #FFFFFF;
  --color-black: #000000;
  --color-text-dark: #0A1A2B;
  --color-text-blue: #0066cc;
  --color-text-red: #cc0000;
  --color-text-aqua: #00D7B6;
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue", sans-serif;
  --font-tagline: "American Typewriter", "Courier New", monospace;
  --max-width: 1200px;
  --pad-desk: 72px;
  --pad-mobile: 20px;
}

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

html { overflow-x: hidden; width: 100%; }

:where(a, button, input, textarea, select):focus-visible {
  outline: 3px solid rgba(3, 177, 151, 0.55);
  outline-offset: 3px;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  font-family: var(--font-sans);
  background: var(--color-white);
  color: var(--color-text-dark);
  overflow-x: hidden;
  width: 100%;
}

/* --------------------------------------------------------------------------
   Subpage header (matches front page nav: logo, links, Download iOS)
   -------------------------------------------------------------------------- */
.subpage-nav-wrap {
  width: 100%;
  max-width: var(--max-width);
  background: var(--color-white);
  border-bottom: 2px solid var(--color-black);
}

.subpage-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: auto;
  padding: 12px var(--pad-desk);
  gap: 9px;
}

.subpage-nav-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1 0 auto;
  min-width: 0;
  padding-right: 8px;
  text-decoration: none;
  color: var(--color-navy);
}

.subpage-nav-logo-icon {
  width: 50px;
  height: 60px;
  object-fit: contain;
  content: url("../images/logo-light.png");
}

.subpage-nav-logo-text {
  font-family: var(--font-sans);
  font-size: 36px;
  font-weight: 900;
  letter-spacing: -0.01em;
  white-space: nowrap;
}

.subpage-nav-links {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 1 1 auto;
  min-width: 0;
  gap: 24px;
}

.subpage-nav-links a {
  color: #425A72;
  text-decoration: none;
  font-size: 16px;
  font-weight: 500;
}

.subpage-nav-links a:hover {
  color: var(--color-navy);
}

.subpage-nav-cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 44px;
  padding: 0 18px;
  background: var(--color-navy);
  color: var(--color-white);
  font-size: 15px;
  font-weight: 700;
  text-decoration: none;
  border-radius: 14px;
  border: 2px solid var(--color-navy);
  flex-shrink: 0;
}

.subpage-nav-cta:hover {
  opacity: 0.9;
}

.subpage-nav-cta.subpage-nav-app-badge {
  margin-left: auto;
  flex: 0 1 152px;
  min-width: 116px;
  padding: 0;
  height: auto;
  background: transparent;
  border: none;
  border-radius: 0;
  position: relative;
}

.subpage-nav-cta.subpage-nav-app-badge img {
  display: block;
  width: 100%;
  min-width: 116px;
  max-width: 152px;
  height: auto;
  object-fit: contain;
  vertical-align: middle;
}

.app-store-badge-link {
  transition: transform 0.18s ease, opacity 0.18s ease;
}

.app-store-badge-link:hover {
  transform: translateY(-1px);
  opacity: 0.96;
}

/* Header with hero image (blog post) */
.subpage-nav-wrap.header-with-hero {
  min-height: 200px;
  background-size: cover;
  background-position: center;
  position: relative;
  border-bottom: none;
}

.subpage-nav-wrap.header-with-hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background: white;
  opacity: 0.5;
  pointer-events: none;
}

.subpage-nav-wrap.header-with-hero .subpage-nav {
  position: relative;
  z-index: 1;
}

/* --------------------------------------------------------------------------
   Blog section & content
   -------------------------------------------------------------------------- */
#blog-section {
  width: 100%;
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 40px 0 50px;
  min-height: 40vh;
}

#blog-content {
  margin: 0 auto;
  max-width: 800px;
  text-align: left;
  padding: 0 20px;
}

#blog-content h1 {
  margin: 0 0 20px;
  color: var(--color-text-dark);
  font-size: 32px;
}

.post-hero {
  margin: 0 0 32px;
}

.post-hero-media {
  position: relative;
  overflow: hidden;
  border-radius: 24px;
  min-height: 320px;
  background: #dfe7ef;
  box-shadow: 0 18px 40px rgba(6, 21, 37, 0.12);
}

.post-hero-image {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 320px;
  object-fit: cover;
}

.post-hero-overlay {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(6, 21, 37, 0.08) 0%, rgba(6, 21, 37, 0.18) 34%, rgba(6, 21, 37, 0.78) 100%);
}

.post-hero-copy {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1;
  padding: 32px;
}

#blog-content .post-hero h1 {
  margin: 0;
  color: var(--color-white);
  font-size: 2.35rem;
  line-height: 1.08;
  max-width: 12ch;
  text-wrap: balance;
}

.post-hero-description {
  margin: 18px auto 34px;
  max-width: 44rem;
  color: #425a72;
  font-size: 1.18rem;
  font-weight: 600;
  line-height: 1.48;
  letter-spacing: -0.02em;
  text-wrap: pretty;
}

.post-article {
  max-width: 44rem;
  margin: 0 auto;
}

.post-article > :first-child {
  margin-top: 0;
}

.post-article img {
  display: block;
  max-width: 100%;
  height: auto;
}

.post-article p:has(> img) {
  margin: 28px 0;
}

.post-article p > img:first-child {
  border-radius: 0;
}

.post-article p > img + img {
  margin-top: 12px;
  border-radius: 18px;
}

#blog-content h2 {
  margin: 56px 0 14px;
  color: var(--color-text-dark);
  font-size: 30px;
  font-weight: 800;
  line-height: 1.12;
  letter-spacing: -0.03em;
}

#blog-content h2:first-child { margin-top: 0; }

#blog-content h3 {
  margin: 34px 0 12px;
  font-size: 22px;
  font-weight: 750;
  line-height: 1.2;
  letter-spacing: -0.02em;
  color: var(--color-text-dark);
}

#blog-content h3:first-child { margin-top: 0; }

#blog-content p {
  color: var(--color-text-dark);
  opacity: 0.9;
  font-size: 16px;
  line-height: 1.72;
  margin-bottom: 18px;
}

#blog-content ul, #blog-content ol {
  color: var(--color-text-dark);
  opacity: 0.9;
  font-size: 16px;
  line-height: 1.6;
  margin-bottom: 15px;
  padding-left: 20px;
}

#blog-content li { margin-bottom: 8px; }

#blog-content hr {
  display: none;
}

#blog-content a {
  color: var(--color-text-dark);
  text-decoration: underline;
}

#blog-content strong {
  color: var(--color-text-dark);
  opacity: 1;
}

#blog-content .effective-date {
  font-style: italic;
  margin-bottom: 1.5em;
  opacity: 0.8;
}

/* Minimal mode (e.g. ?minimal=1 for embedding) */
.minimal-mode .subpage-nav-wrap,
.minimal-mode .subpage-footer,
.minimal-mode .section-divider {
  display: none !important;
}

/* Docs index grid */
.docs-section-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1.5rem;
  width: 100%;
  max-width: 800px;
  margin: 0 auto;
}

.docs-section-card {
  padding: 1rem;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 8px;
}

.docs-section-card-title { font-size: 1.1rem; margin: 0 0 0; line-height: 1.2; }
.docs-section-card-title a { text-decoration: none; color: inherit; }
.docs-section-card-title a:hover { text-decoration: underline; }
.docs-section-card-subtitle { font-size: 0.9rem; opacity: 0.85; margin: 0 0 0.75rem 0; line-height: 1.3; }
#blog-content .docs-section-card .docs-section-card-title { margin: 0; }
#blog-content .docs-section-card .docs-section-card-subtitle { margin-top: 5px; margin-bottom: 0.75rem; }
#blog-content .docs-section-card .docs-section-card-list { margin: 0; padding-left: 1.25rem; font-size: 0.95rem; }
#blog-content .docs-section-card .docs-section-card-list li { margin-bottom: 0.25rem; }

.docs-action-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  max-width: 800px;
  margin: 2rem auto 0;
}

.docs-action-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 0.75rem;
  padding: 1.25rem 1rem;
  background: rgba(0, 0, 0, 0.06);
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: 8px;
  text-decoration: none;
  color: inherit;
  transition: background-color 0.2s ease, border-color 0.2s ease;
}

.docs-action-box:hover {
  background: rgba(0, 0, 0, 0.09);
  border-color: rgba(0, 0, 0, 0.14);
}

.docs-action-icon { display: flex; align-items: center; justify-content: center; color: var(--color-black); opacity: 0.85; }
.docs-action-label { font-size: 1rem; font-weight: 500; text-align: center; }

#blog-content:has(.docs-section-grid) { padding-left: 0; padding-right: 0; }

/* Post list (blog index) */
.post-list {
  display: flex;
  flex-direction: column;
  gap: 2.5rem;
  width: 100%;
  max-width: 800px;
  margin: 0 auto;
}

.post-card {
  display: flex;
  align-items: stretch;
  gap: 0;
  width: 100%;
  min-height: 220px;
  border-radius: 20px;
  overflow: hidden;
  background: #fff;
  border: 1px solid rgba(0, 0, 0, 0.08);
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
  transition: box-shadow 0.2s ease, transform 0.2s ease, background-color 0.2s ease;
  text-decoration: none !important;
  color: inherit !important;
}

.post-card:hover {
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1);
  background: rgba(0, 0, 0, 0.01);
}

.post-card-imageWrap {
  flex: 0 0 40%;
  min-width: 0;
  overflow: hidden;
  border-radius: 20px 0 0 20px;
}

.post-card-image {
  width: 100%;
  height: 100%;
  min-height: 220px;
  object-fit: cover;
  transition: transform 0.35s ease;
}

.post-card:hover .post-card-image { transform: scale(1.03); }

.post-card-text {
  flex: 1 1 60%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-start;
  gap: 0.3rem;
  padding: 1rem 1.5rem 1.6rem 1.5rem;
  min-width: 0;
}

.post-card-date {
  font-size: 0.85rem;
  font-weight: 400;
  color: #6b7280;
  letter-spacing: 0.02em;
}

.post-card-title {
  font-family: var(--font-sans);
  font-size: 1.5rem;
  font-weight: 900;
  line-height: 1.25;
  margin: 0;
  color: var(--color-text-dark);
}

.post-card-excerpt {
  margin: 0;
  font-size: 1rem;
  font-weight: 400;
  line-height: 1.5;
  color: #374151;
}

.post-card:not(:has(.post-card-imageWrap)) .post-card-text { padding-left: 1.5rem; }

/* Pagination */
.pagination {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.5rem 1rem;
  margin-top: 3rem;
  padding-top: 2rem;
}

.pagination-link {
  color: var(--color-text-dark);
  text-decoration: none;
  font-size: 0.9375rem;
  padding: 0.4rem 0.75rem;
  border-radius: 6px;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.pagination-link:hover { background-color: rgba(0, 0, 0, 0.06); }

.pagination-numbers { display: flex; align-items: center; gap: 0.25rem; }

.pagination-num.pagination-current {
  font-weight: 600;
  background-color: rgba(0, 0, 0, 0.08);
  pointer-events: none;
}

.pagination-prev, .pagination-next { color: #6b7280; }

/* Workout block (docs) */
.workout-block-wrapper {
  position: relative;
  margin: 20px 0;
  background: #f5f5f5;
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: 8px;
  overflow: hidden;
}

.workout-block {
  margin: 0;
  padding: 16px;
  background: transparent;
  border: none;
  font-family: var(--font-tagline);
  font-size: 18px;
  line-height: 1.6;
  color: var(--color-text-dark);
  white-space: pre-wrap;
  word-wrap: break-word;
  overflow-x: auto;
}

.workout-block code {
  font-family: inherit;
  font-size: inherit;
  background: transparent;
  padding: 0;
  border: none;
  color: inherit;
}

.workout-block .workout-zone-blue { color: var(--color-text-blue); }
.workout-block .workout-zone-red { color: var(--color-text-red); }
.workout-block .workout-zone-aqua { color: var(--color-text-aqua); }
.workout-block .workout-comment-hash { color: var(--color-text-aqua); }
.workout-block .workout-comment-text { color: #999; }

.workout-block-copy {
  position: absolute;
  top: 8px;
  right: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  color: var(--color-text-dark);
  opacity: 0.7;
  transition: opacity 0.2s, background-color 0.2s;
}

.workout-block-copy:hover {
  opacity: 1;
  background: #fff;
}

.workout-block-copy.copied {
  opacity: 1;
  background: #e8f5e9;
  border-color: #4caf50;
}

/* Doc prev/next */
.doc-prevnext {
  display: flex;
  gap: 1rem;
  margin-top: 2.5rem;
  margin-left: -20px;
  margin-right: -20px;
}

.doc-prevnext-link {
  flex: 1;
  display: block;
  padding: 1rem;
  border: 1px solid rgba(0, 0, 0, 0.12);
  border-radius: 12px;
  text-decoration: none;
  color: inherit;
}

.doc-prevnext-next { text-align: right; }

.doc-prevnext-kicker { display: block; font-size: 0.85rem; opacity: 0.7; }
.doc-prevnext-title { display: block; margin-top: 0.25rem; font-weight: 600; }

.doc-prevnext-index {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  padding: 0 0.5rem;
  color: var(--color-text-dark);
  text-decoration: underline;
  font-size: 0.95rem;
}

.doc-prevnext-index:hover { opacity: 0.8; }

/* Subpage footer (match landing dark footer) */
.subpage-footer {
  width: 100%;
  max-width: var(--max-width);
  min-height: 90px;
  background: var(--color-navy-deep);
  padding: 0 var(--pad-desk);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}

.subpage-footer .footer-copy {
  font-size: 16px;
  font-weight: 600;
  color: var(--color-white);
}

.subpage-footer .footer-copy a {
  color: inherit;
  text-decoration: none;
}

.subpage-footer .footer-copy a:hover {
  text-decoration: underline;
}

.subpage-footer .footer-links {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.subpage-footer .footer-links a {
  color: var(--color-white);
  text-decoration: none;
  font-size: 16px;
  font-weight: 600;
}

.subpage-footer .footer-links a:hover { text-decoration: underline; }

.subpage-footer .footer-app-store {
  display: inline-block;
  position: relative;
}

.subpage-footer .footer-app-store img {
  width: 245px;
  height: 82px;
  object-fit: contain;
  vertical-align: middle;
}

.subpage-footer .coming-soon {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: var(--color-aqua);
  color: var(--color-navy);
  padding: 6px 18px;
  border-radius: 8px;
  font-weight: 800;
  font-size: 18px;
  white-space: nowrap;
  opacity: 0;
  transition: opacity 0.2s;
  pointer-events: none;
}

.subpage-footer .footer-app-store:hover .coming-soon { opacity: 1; }

/* Narrow screens */
@media (max-width: 1200px) {
  .subpage-nav {
    padding: 12px var(--pad-mobile);
  }

  .subpage-nav-links {
    display: none;
  }

  .subpage-nav-logo {
    flex: 1 1 auto;
  }

  .subpage-nav-cta.subpage-nav-app-badge {
    flex: 0 1 152px;
  }

  .subpage-nav-cta.subpage-nav-app-badge img {
    width: 100%;
    height: auto;
  }
}

@media (max-width: 700px) {
  .subpage-nav-logo-text {
    font-size: clamp(24px, 6.8vw, 36px);
  }
}

@media (max-width: 640px) {
  #blog-content { padding-left: 1rem; padding-right: 1rem; }
  .post-hero { margin-bottom: 24px; }
  .post-hero-media {
    min-height: 260px;
    border-radius: 18px;
  }
  .post-hero-image {
    min-height: 260px;
  }
  .post-hero-copy {
    padding: 20px 18px;
  }
  #blog-content .post-hero h1 {
    font-size: 1.85rem;
    max-width: 100%;
  }
  .post-hero-description {
    margin: 14px auto 26px;
    font-size: 1.04rem;
    line-height: 1.45;
  }
  .post-article {
    max-width: 100%;
  }
  #blog-content h2 {
    margin-top: 44px;
    margin-bottom: 12px;
    font-size: 2rem;
  }
  #blog-content h3 {
    margin-top: 30px;
    margin-bottom: 10px;
    font-size: 1.35rem;
  }
  #blog-content:has(.docs-section-grid) {
    margin-left: 0;
    margin-right: 0;
    padding-left: 1rem;
    padding-right: 1rem;
    max-width: none;
    width: 100%;
  }
  .docs-section-grid { grid-template-columns: 1fr; }
  #blog-content:has(.docs-section-grid) h1 { text-align: center; }
  .docs-section-card { text-align: center; }
  #blog-content .docs-section-card .docs-section-card-list {
    padding-left: 0;
    list-style-position: inside;
    margin-left: 0;
    margin-right: 0;
  }
  .docs-action-row { grid-template-columns: 1fr; }
  .post-list { gap: 1.75rem; }
  .post-card { flex-direction: column; min-height: 0; }
  .post-card-imageWrap {
    flex: none;
    width: 100%;
    height: 200px;
    border-radius: 20px 20px 0 0;
  }
  .post-card-image { min-height: 200px; width: 100%; height: 100%; }
  .post-card-text { padding: 1.1rem 1.35rem 1.35rem; gap: 0.28rem; }
  .post-card-title { font-size: 1.25rem; }
  .post-card-excerpt {
    font-size: 0.9375rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }
  .subpage-footer {
    min-height: auto;
    padding: 20px var(--pad-mobile) 24px;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 10px;
  }
  .subpage-footer .footer-copy { font-size: 13px; }
  .subpage-footer .footer-links a { font-size: 13px; }
}

/* --------------------------------------------------------------------------
   Dark mode (prefers-color-scheme: dark)
   Coloured sections (aqua footer badge, etc.) unchanged.
   -------------------------------------------------------------------------- */
@media (prefers-color-scheme: dark) {
  body {
    background: #0d1117;
    color: #e6edf3;
  }

  .subpage-nav-logo-icon {
    content: url("../images/logo-dark.png");
  }

  .subpage-nav-wrap {
    background: #0d1117;
    border-bottom-color: #30363d;
  }

  .subpage-nav-logo {
    color: #e6edf3;
  }

  .subpage-nav-links a {
    color: #8b949e;
  }

  .subpage-nav-links a:hover {
    color: #e6edf3;
  }

  .subpage-nav-wrap.header-with-hero::before {
    background: #0d1117;
    opacity: 0.6;
  }

  #blog-section {
    background: #0d1117;
  }

  #blog-content {
    color: #e6edf3;
  }

  #blog-content h1,
  #blog-content h2,
  #blog-content h3 {
    color: #e6edf3;
  }

  .post-hero-media {
    background: #161b22;
    box-shadow: 0 18px 40px rgba(0, 0, 0, 0.28);
  }

  .post-hero-overlay {
    background:
      linear-gradient(180deg, rgba(13, 17, 23, 0.12) 0%, rgba(13, 17, 23, 0.22) 34%, rgba(13, 17, 23, 0.84) 100%);
  }

  #blog-content .post-hero h1 {
    color: #f8fafc;
  }

  .post-hero-description {
    color: #9fb0c3;
  }

  #blog-content p,
  #blog-content li {
    color: #c9d1d9;
  }

  #blog-content a {
    color: #58a6ff;
  }

  #blog-content a:hover {
    color: #79b8ff;
  }

  #blog-content .effective-date {
    color: #c9d1d9;
  }

  #blog-content .effective-date strong {
    color: #e6edf3;
  }

  #blog-content strong {
    color: #e6edf3;
  }

  .docs-section-card {
    background: #161b22;
    border-color: #30363d;
    color: #e6edf3;
  }

  .docs-section-card:hover {
    background: #21262d;
    border-color: #484f58;
  }

  .docs-action-box {
    background: rgba(255, 255, 255, 0.03);
    border-color: rgba(255, 255, 255, 0.08);
  }

  .docs-action-box:hover {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(255, 255, 255, 0.12);
  }

  .docs-action-icon {
    color: #e6edf3;
  }

  .post-card {
    background: #161b22;
    border-color: #30363d;
  }

  .post-card:hover {
    background: #21262d;
  }

  .post-card-title,
  .post-card-excerpt {
    color: #e6edf3;
  }

  .post-card-excerpt {
    color: #8b949e;
  }

  .post-card-text {
    color: #c9d1d9;
  }

  .pagination-link {
    background: rgba(255, 255, 255, 0.06);
    color: #e6edf3;
  }

  .pagination-link:hover {
    background: rgba(255, 255, 255, 0.1);
  }

  .pagination-num.pagination-current {
    background: rgba(255, 255, 255, 0.12);
  }

  .pagination-prev,
  .pagination-next {
    color: #8b949e;
  }

  .workout-block-wrapper {
    background: #161b22;
    border-color: #30363d;
  }

  .workout-block {
    color: #e6edf3;
  }

  .workout-block-copy {
    background: rgba(33, 38, 45, 0.95);
    border-color: #30363d;
    color: #e6edf3;
  }

  .workout-block-copy:hover {
    background: #21262d;
  }

  .workout-block-copy.copied {
    background: rgba(34, 197, 94, 0.2);
    border-color: #22c55e;
  }

  .doc-prevnext-link {
    border-color: #30363d;
    color: #e6edf3;
  }

  .doc-prevnext-link:hover {
    background: #161b22;
  }

  .minimal-mode .workout-block {
    background: #161b22;
    border-color: #30363d;
    color: #e6edf3;
  }

  .copy-workout-btn {
    background: #21262d;
    color: #e6edf3;
    border-color: #30363d;
  }

  .copy-workout-btn:hover {
    background: #30363d;
  }

  .blog-index-intro {
    color: #8b949e;
  }

  /* Footer: keep navy – no override */
}
