@import url("https://fonts.googleapis.com/css2?family=Ysabeau+Office:ital,wght@0,1..1000;1,1..1000&family=Ysabeau+SC:wght@1..1000&display=swap");
@import url("https://cdn.jsdelivr.net/npm/@joshuasu/lxgwbright-code-web@2.711.0/style.min.css");

/* ===========================================
   THEME DEFINITIONS
   Default: Synthwave | Toggle: System (auto)
   =========================================== */

/* Synthwave theme - DEFAULT */
:root {
  --text-color: #f0e6ff;
  --bg-color: #0f0a1a;
  --bg-gradient:
    radial-gradient(
      ellipse 80% 60% at 10% -10%,
      rgba(255, 41, 117, 0.3),
      transparent 50%
    ),
    radial-gradient(
      ellipse 70% 50% at 90% 10%,
      rgba(0, 255, 249, 0.25),
      transparent 50%
    ),
    radial-gradient(
      ellipse 90% 60% at 50% 120%,
      rgba(185, 103, 255, 0.25),
      transparent 50%
    );
  --link-color: #00fff9;
  --link-hover: #ff2975;
  --link-underline: rgba(0, 255, 249, 0.5);
  --link-underline-hover: rgba(255, 41, 117, 0.8);
  --pr-line-bg: rgba(185, 103, 255, 0.1);
  --pr-line-glow: rgba(0, 255, 249, 0.4);
  --pr-bar-gradient: linear-gradient(to bottom, #ff2975, #b967ff, #00fff9);
  --pr-bar-shadow:
    0 0 8px rgba(255, 41, 117, 0.6), 0 0 16px rgba(0, 255, 249, 0.4);
  --pr-bar-shadow-hover:
    0 0 12px rgba(255, 41, 117, 0.8), 0 0 24px rgba(0, 255, 249, 0.6);
  --pr-text-shadow:
    0 0 10px rgba(0, 255, 249, 0.9), 0 0 20px rgba(185, 103, 255, 0.6),
    0 0 30px rgba(255, 41, 117, 0.4);
  --pr-text-shadow-hover:
    0 0 14px rgba(0, 255, 249, 1), 0 0 28px rgba(185, 103, 255, 0.8),
    0 0 40px rgba(255, 41, 117, 0.6);
  --stats-bg: rgba(185, 103, 255, 0.15);
  --hr-color: #b967ff;
  --skip-link-bg: #ff2975;
  --skip-link-text: #0f0a1a;
  --toggle-bg: rgba(185, 103, 255, 0.3);
  --toggle-border: #b967ff;
  --is-synthwave: 1;
}

/* Light theme */
html:has(#theme-light:checked) {
  --text-color: #1a1a1a;
  --bg-color: #fdfdfd;
  --bg-gradient: none;
  --link-color: #1a1a1a;
  --link-hover: #1a1a1a;
  --link-underline: rgba(26, 26, 26, 0.4);
  --link-underline-hover: rgba(26, 26, 26, 0.8);
  --pr-line-bg: rgba(26, 26, 26, 0.03);
  --pr-line-glow: rgba(26, 26, 26, 0.15);
  --pr-bar-gradient: linear-gradient(to bottom, #ff6b6b, #4ecdc4);
  --pr-bar-shadow: 0 0 4px rgba(255, 107, 107, 0.4);
  --pr-bar-shadow-hover: 0 0 8px rgba(255, 107, 107, 0.6);
  --pr-text-shadow:
    0 1px 2px rgba(0, 0, 0, 0.1), 0 0 4px rgba(230, 230, 230, 0.6),
    0 0 8px rgba(230, 230, 230, 0.4);
  --pr-text-shadow-hover:
    0 1px 3px rgba(0, 0, 0, 0.15), 0 0 6px rgba(230, 230, 230, 0.7),
    0 0 12px rgba(230, 230, 230, 0.5);
  --stats-bg: rgba(26, 26, 26, 0.05);
  --hr-color: #1a1a1a;
  --skip-link-bg: #1a1a1a;
  --skip-link-text: #fdfdfd;
  --toggle-bg: rgba(26, 26, 26, 0.1);
  --toggle-border: #1a1a1a;
}

/* Dark theme */
html:has(#theme-dark:checked) {
  --text-color: #e0e0e0;
  --bg-color: #1a1a1a;
  --bg-gradient: none;
  --link-color: #e0e0e0;
  --link-hover: #e0e0e0;
  --link-underline: rgba(224, 224, 224, 0.5);
  --link-underline-hover: rgba(224, 224, 224, 0.8);
  --pr-line-bg: rgba(224, 224, 224, 0.08);
  --pr-line-glow: rgba(100, 200, 255, 0.3);
  --pr-bar-gradient: linear-gradient(to bottom, #a855f7, #06b6d4);
  --pr-bar-shadow:
    0 0 6px rgba(168, 85, 247, 0.6), 0 0 12px rgba(6, 182, 212, 0.4);
  --pr-bar-shadow-hover:
    0 0 10px rgba(168, 85, 247, 0.8), 0 0 20px rgba(6, 182, 212, 0.6);
  --pr-text-shadow:
    0 0 8px rgba(100, 200, 255, 0.8), 0 0 15px rgba(100, 200, 255, 0.5),
    0 0 25px rgba(100, 200, 255, 0.3);
  --pr-text-shadow-hover:
    0 0 10px rgba(100, 200, 255, 1), 0 0 20px rgba(100, 200, 255, 0.7),
    0 0 30px rgba(100, 200, 255, 0.4);
  --stats-bg: rgba(224, 224, 224, 0.1);
  --hr-color: #e0e0e0;
  --skip-link-bg: #e0e0e0;
  --skip-link-text: #1a1a1a;
  --toggle-bg: rgba(224, 224, 224, 0.1);
  --toggle-border: #e0e0e0;
}

html {
  color: var(--text-color);
  background: var(--bg-gradient), var(--bg-color);
  background-color: var(--bg-color);
  background-attachment: fixed;
  min-height: 100vh;
  line-height: 1.15;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0 auto;
  max-width: 60em;
  padding: 1em;
  background: transparent;
  color: var(--text-color);
  hyphens: auto;
  overflow-wrap: break-word;
  text-rendering: optimizeLegibility;
  font-kerning: normal;
  font-family: "Ysabeau Office", "LXGW Bright Code Light", sans-serif;
  font-optical-sizing: auto;
  font-size: 1.2rem;
  position: relative;
  min-height: 100vh;
}

/* Mobile optimization */
@media (max-width: 768px) {
  body {
    font-size: 1rem;
    padding: 0.5em;
  }

  h1,
  h2,
  h3,
  h4,
  h5,
  h6 {
    font-size: 1.5em;
  }

  li {
    margin: 0.2em 0;
    padding: 0.1em 0;
  }

  ul {
    padding-left: 1.2em;
  }
}

p {
  margin: 1em 0;
}

a {
  color: var(--link-color);
  background-color: transparent;
  text-decoration: none;
  transition:
    color 0.2s ease,
    opacity 0.2s ease;
}

a:hover {
  color: var(--link-hover);
}

/* Underline only for links in paragraphs (like "my running page") */
p a {
  text-decoration: underline;
  text-decoration-color: var(--link-underline);
  text-underline-offset: 0.15em;
  transition:
    color 0.2s ease,
    opacity 0.2s ease,
    text-decoration-color 0.2s ease;
}

p a:hover {
  opacity: 0.8;
  text-decoration-color: var(--link-underline-hover);
}

/* No underline for links in list items */
li a {
  text-decoration: none;
}

li a:hover {
  opacity: 0.7;
  text-decoration: underline;
}

a:visited {
  color: var(--link-color);
}

b,
strong {
  font-weight: bolder;
}

h1,
h2,
h3,
h4,
h5,
h6 {
  font-family: "Ysabeau SC", serif;
  font-size: 2em;
  margin: 0.67em 0;
}

ol,
ul {
  padding-left: 1.7em;
  margin-top: 1em;
}

li {
  margin: 0.2em 0;
  padding: 0.1em 0;
  line-height: 1.5;
}

code {
  font-family: "Ysabeau Office", monospace, monospace;
  font-size: 1em;
  margin: 0;
  hyphens: manual;
  white-space: pre-wrap;
}

/* Race times styling */
li > code:first-child,
li > a > code:first-child {
  color: var(--text-color);
  background-color: transparent;
}

pre {
  font-family: "Ysabeau Office", monospace, monospace;
  font-size: 1em;
  margin: 1em 0;
  overflow: auto;
}

pre code {
  padding: 0;
  overflow: visible;
  overflow-wrap: normal;
}

.sourceCode {
  background-color: transparent;
  overflow: visible;
}

hr {
  box-sizing: content-box; /* 1 */
  height: 0; /* 1 */
  overflow: visible; /* 2 */
  background-color: var(--hr-color);
  border: none;
  margin: 1em 0;
}

header {
  margin-bottom: 4em;
  text-align: center;
}

span.smallcaps {
  font-variant: small-caps;
}

div.columns {
  display: flex;
  gap: min(4vw, 1.5em);
}

div.column {
  flex: auto;
  overflow-x: auto;
}

div.hanging-indent {
  margin-left: 1.5em;
  text-indent: -1.5em;
}

/* PR line visual effects - vertical bar and neon glow */
li.pr-line {
  position: relative;
}

/* Vertical bar - uses theme variables */
li.pr-line::before {
  content: "";
  position: absolute;
  left: -1.7em;
  top: 0.2em;
  bottom: 0.2em;
  width: 4px;
  border-radius: 2px;
  background: var(--pr-bar-gradient);
  box-shadow: var(--pr-bar-shadow);
  transition:
    width 0.2s ease,
    box-shadow 0.2s ease;
}

li.pr-line:hover::before {
  width: 5px;
  box-shadow: var(--pr-bar-shadow-hover);
}

/* Text glow effect - uses theme variables */
li.pr-line > code:first-child,
li.pr-line > a > code:first-child,
li.pr-line code,
li.pr-line a,
li.pr-line a:visited {
  text-shadow: var(--pr-text-shadow);
  transition: text-shadow 0.3s ease;
}

li.pr-line:hover > code:first-child,
li.pr-line:hover > a > code:first-child,
li.pr-line:hover code,
li.pr-line:hover a,
li.pr-line:hover a:visited {
  text-shadow: var(--pr-text-shadow-hover);
}

/* Synthwave breathing animation - only when NOT in system mode */
@keyframes synthwave-text-breathe {
  0%,
  100% {
    text-shadow:
      0 0 8px rgba(0, 255, 249, 0.7),
      0 0 16px rgba(185, 103, 255, 0.4),
      0 0 24px rgba(255, 41, 117, 0.3);
  }
  50% {
    text-shadow:
      0 0 14px rgba(0, 255, 249, 1),
      0 0 28px rgba(185, 103, 255, 0.8),
      0 0 40px rgba(255, 41, 117, 0.6);
  }
}

/* Larger breathing glow for title */
@keyframes synthwave-title-breathe {
  0%,
  100% {
    text-shadow:
      0 0 10px rgba(0, 255, 249, 0.6),
      0 0 20px rgba(185, 103, 255, 0.4),
      0 0 40px rgba(255, 41, 117, 0.3),
      0 0 60px rgba(0, 255, 249, 0.2);
  }
  50% {
    text-shadow:
      0 0 20px rgba(0, 255, 249, 1),
      0 0 40px rgba(185, 103, 255, 0.8),
      0 0 60px rgba(255, 41, 117, 0.5),
      0 0 80px rgba(0, 255, 249, 0.3);
  }
}

@keyframes synthwave-bar-breathe {
  0%,
  100% {
    box-shadow:
      0 0 6px rgba(255, 41, 117, 0.5),
      0 0 12px rgba(0, 255, 249, 0.3);
  }
  50% {
    box-shadow:
      0 0 14px rgba(255, 41, 117, 0.9),
      0 0 28px rgba(0, 255, 249, 0.7);
  }
}

@keyframes synthwave-toggle-breathe {
  0%,
  100% {
    box-shadow:
      0 0 6px rgba(185, 103, 255, 0.4),
      0 0 12px rgba(255, 41, 117, 0.2);
  }
  50% {
    box-shadow:
      0 0 12px rgba(185, 103, 255, 0.7),
      0 0 20px rgba(255, 41, 117, 0.4);
  }
}

/* Apply breathing animation in Synthwave mode */
html:has(#theme-synthwave:checked) h1 {
  animation: synthwave-title-breathe 4s ease-in-out infinite;
}

html:has(#theme-synthwave:checked) li.pr-line::before {
  animation: synthwave-bar-breathe 3s ease-in-out infinite;
}

html:has(#theme-synthwave:checked) li.pr-line > code:first-child,
html:has(#theme-synthwave:checked) li.pr-line > a > code:first-child,
html:has(#theme-synthwave:checked) li.pr-line code,
html:has(#theme-synthwave:checked) li.pr-line a,
html:has(#theme-synthwave:checked) li.pr-line a:visited {
  animation: synthwave-text-breathe 3s ease-in-out infinite;
}

/* Pause animation on hover for better interaction feel */
html:has(#theme-synthwave:checked) li.pr-line:hover::before,
html:has(#theme-synthwave:checked) li.pr-line:hover > code:first-child,
html:has(#theme-synthwave:checked) li.pr-line:hover > a > code:first-child,
html:has(#theme-synthwave:checked) li.pr-line:hover code,
html:has(#theme-synthwave:checked) li.pr-line:hover a,
html:has(#theme-synthwave:checked) li.pr-line:hover a:visited {
  animation-play-state: paused;
}

/* Section headers (h2) glow in Synthwave mode */
html:has(#theme-synthwave:checked) h2 {
  text-shadow:
    0 0 8px rgba(185, 103, 255, 0.6),
    0 0 16px rgba(185, 103, 255, 0.3);
}

/* HR gradient glow in Synthwave mode */
html:has(#theme-synthwave:checked) hr {
  height: 2px;
  background: linear-gradient(
    90deg,
    transparent,
    #ff2975 20%,
    #b967ff 50%,
    #00fff9 80%,
    transparent
  );
  box-shadow:
    0 0 8px rgba(185, 103, 255, 0.5),
    0 0 16px rgba(255, 41, 117, 0.3);
}

/* Theme toggle button - single cycling button */
.theme-toggle {
  position: fixed;
  top: 1em;
  right: 1em;
  z-index: 1000;
  width: 2.5em;
  height: 2.5em;
}

.theme-toggle input {
  display: none;
}

.theme-toggle .theme-btn {
  position: absolute;
  top: 0;
  left: 0;
  display: none;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  cursor: pointer;
  color: var(--text-color);
  background: var(--toggle-bg);
  border: 1px solid var(--toggle-border);
  border-radius: 50%;
  backdrop-filter: blur(10px);
  transition:
    transform 0.3s ease,
    box-shadow 0.3s ease;
}

.theme-toggle .theme-btn:hover {
  transform: scale(1.1);
  box-shadow: 0 0 15px var(--toggle-border);
}

.theme-toggle .theme-btn svg {
  width: 1.2em;
  height: 1.2em;
}

/* Show appropriate button based on current theme */
/* Synthwave active → show wave icon button */
html:has(#theme-synthwave:checked) .theme-toggle label.btn-synthwave {
  display: flex;
}

/* Light active → show sun icon button */
html:has(#theme-light:checked) .theme-toggle label.btn-light {
  display: flex;
}

/* Dark active → show moon icon button */
html:has(#theme-dark:checked) .theme-toggle label.btn-dark {
  display: flex;
}

/* Breathing animation for button in Synthwave mode */
html:has(#theme-synthwave:checked) .theme-toggle .theme-btn {
  animation: synthwave-toggle-breathe 4s ease-in-out infinite;
}

html:has(#theme-synthwave:checked) .theme-toggle .theme-btn:hover {
  animation-play-state: paused;
  box-shadow:
    0 0 20px rgba(185, 103, 255, 0.8),
    0 0 30px rgba(255, 41, 117, 0.5);
}

/* Mobile adjustments for toggle */
@media (max-width: 768px) {
  .theme-toggle {
    top: 0.5em;
    right: 0.5em;
    width: 2em;
    height: 2em;
  }

  .theme-toggle .theme-btn svg {
    width: 1em;
    height: 1em;
  }
}

/* Summary statistics styling */
.stats-summary {
  background-color: var(--stats-bg);
  padding: 1em;
  border-radius: 0.5em;
  margin: 2em 0;
  font-size: 0.9em;
}

.stats-summary h3 {
  font-size: 1.2em;
  margin-top: 0;
  margin-bottom: 0.5em;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 1em;
  margin-top: 0.5em;
}

.stat-item {
  display: flex;
  flex-direction: column;
}

.stat-label {
  font-size: 0.85em;
  opacity: 0.7;
  margin-bottom: 0.2em;
}

.stat-value {
  font-size: 1.3em;
  font-weight: 600;
  font-family: "Ysabeau SC", serif;
}

/* Skip link for accessibility */
.skip-link {
  position: absolute;
  top: -40px;
  left: 0;
  background: var(--skip-link-bg);
  color: var(--skip-link-text);
  padding: 8px;
  text-decoration: none;
  z-index: 100;
}

.skip-link:focus {
  top: 0;
}

/* Print styles */
@media print {
  html {
    background: #ffffff;
  }

  body {
    max-width: 100%;
    padding: 0;
    font-size: 10pt;
  }

  .stats-summary {
    break-inside: avoid;
    page-break-inside: avoid;
  }

  .theme-toggle {
    display: none;
  }

  a {
    text-decoration: underline;
    color: #1a1a1a;
  }

  a[href^="http"]:after {
    content: " (" attr(href) ")";
    font-size: 0.8em;
    color: #666;
  }

  li.pr-line::before {
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  /* Force light mode for printing */
  :root {
    --text-color: #1a1a1a;
    --bg-color: #ffffff;
    --link-color: #1a1a1a;
    --pr-text-shadow: none;
    --pr-text-shadow-hover: none;
  }

  @page {
    margin: 1cm;
  }
}

/* The followings are from normalize.css */
