/* =========================================================
   PERFORMANCE HUB — SHARED DESIGN SYSTEM
   Scoped to #notes-root; no HTML changes required.
   ========================================================= */

#notes-root {
  --hub-bg: #0b1220;
  --hub-surface: #121925;
  --hub-surface-raised: #192231;
  --hub-surface-hover: #202b3b;
  --hub-border: rgba(148, 163, 184, 0.14);
  --hub-border-strong: rgba(148, 163, 184, 0.28);

  --hub-text: #e5eaf1;
  --hub-text-secondary: #a0acbc;
  --hub-text-muted: #778498;

  --hub-accent: #6ee7b7;
  --hub-accent-hover: #8af0c8;
  --hub-accent-ink: #092019;
  --hub-accent-subtle: rgba(110, 231, 183, 0.09);

  --hub-radius-sm: 10px;
  --hub-radius-md: 16px;
  --hub-radius-lg: 20px;

  --hub-shadow: 0 20px 50px rgba(0, 0, 0, 0.16);

  width: 100%;
  max-width: 1100px;
  margin-inline: auto;
  padding: 32px 22px 48px;
  color: var(--hub-text);
  font-family: var(--main-font-family, inherit);
  font-size: var(--main-font-size, 14px);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  overflow-wrap: anywhere;
  margin: 2rem 0;
}

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

#notes-root h1,
#notes-root h2,
#notes-root h3,
#notes-root h4,
#notes-root p {
  margin-top: 0;
}

#notes-root button,
#notes-root table {
  font: inherit;
}

#notes-root button {
  color: inherit;
}

#notes-root ::selection {
  color: var(--hub-accent-ink);
  background: var(--hub-accent);
}

#notes-root :focus-visible {
  outline: 2px solid var(--hub-accent);
  outline-offset: 4px;
}

#notes-root [hidden] {
  display: none !important;
}

/* =========================================================
   SHARED EYEBROWS, HEADERS AND TYPOGRAPHY
   ========================================================= */

#notes-root .dashboard-header,
#notes-root .page-header {
  max-width: 850px;
  margin-bottom: clamp(32px, 5vw, 56px);
}

#notes-root .dashboard-header__eyebrow,
#notes-root .page-header__eyebrow {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
  color: var(--hub-accent);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.17em;
  line-height: 1.4;
  text-transform: uppercase;
}

#notes-root .dashboard-header__eyebrow::before,
#notes-root .page-header__eyebrow::before {
  width: 22px;
  height: 2px;
  background: var(--hub-accent);
  content: "";
  flex: 0 0 auto;
}

#notes-root .dashboard-header__title,
#notes-root .page-header__title {
  margin-bottom: 14px;
  color: var(--hub-text);
  font-size: clamp(34px, 5.5vw, 58px);
  font-weight: 750;
  letter-spacing: -0.055em;
  line-height: 1.08;
  text-wrap: balance;
}

#notes-root .dashboard-header__description,
#notes-root .page-header__description {
  max-width: 640px;
  margin-bottom: 0;
  color: var(--hub-text-secondary);
  font-size: clamp(14px, 1.5vw, 17px);
  line-height: 1.8;
}

/* =========================================================
   DASHBOARD
   ========================================================= */

#notes-root .dashboard {
  width: 100%;
}

#notes-root .dashboard-header {
  position: relative;
  padding-block: 12px 30px;
}

#notes-root .dashboard-header::after {
  display: block;
  width: 100%;
  max-width: 180px;
  height: 3px;
  margin-top: 30px;
  background: linear-gradient(90deg, var(--hub-accent), transparent);
  content: "";
}

#notes-root .dashboard-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

#notes-root .dashboard-tile {
  position: relative;
  display: flex;
  min-width: 0;
  min-height: 245px;
  flex-direction: column;
  align-items: flex-start;
  padding: clamp(22px, 3vw, 34px);
  overflow: hidden;
  border: 1px solid var(--hub-border);
  border-radius: var(--hub-radius-lg);
  background: var(--hub-surface);
  text-align: left;
  cursor: pointer;
  transition:
    background 180ms ease,
    border-color 180ms ease,
    transform 180ms ease,
    box-shadow 180ms ease;
}

#notes-root .dashboard-tile::before {
  position: absolute;
  inset: 0 auto 0 0;
  width: 3px;
  background: var(--hub-accent);
  content: "";
  opacity: 0;
  transition: opacity 180ms ease;
}

#notes-root .dashboard-tile:hover {
  transform: translateY(-3px);
  border-color: var(--hub-border-strong);
  background: var(--hub-surface-raised);
  box-shadow: var(--hub-shadow);
}

#notes-root .dashboard-tile:hover::before,
#notes-root .dashboard-tile:focus-visible::before {
  opacity: 1;
}

#notes-root .dashboard-tile__number {
  margin-bottom: auto;
  color: var(--hub-accent);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.12em;
  font-variant-numeric: tabular-nums;
}

#notes-root .dashboard-tile__title {
  display: block;
  max-width: calc(100% - 24px);
  margin-top: 36px;
  margin-bottom: 12px;
  color: var(--hub-text);
  font-size: clamp(15px, 1.7vw, 19px);
  font-weight: 800;
  letter-spacing: 0.025em;
  line-height: 1.4;
}

#notes-root .dashboard-tile__description {
  display: block;
  max-width: 420px;
  padding-right: 8px;
  color: var(--hub-text-secondary);
  font-size: 13px;
  line-height: 1.8;
}

#notes-root .dashboard-tile__arrow {
  position: absolute;
  right: 26px;
  bottom: 27px;
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border: 1px solid var(--hub-border);
  border-radius: 50%;
  color: var(--hub-accent);
  font-size: 19px;
  line-height: 1;
  transition:
    background 180ms ease,
    color 180ms ease,
    transform 180ms ease;
}

#notes-root .dashboard-tile:hover .dashboard-tile__arrow {
  transform: translateX(3px);
  border-color: var(--hub-accent);
  background: var(--hub-accent);
  color: var(--hub-accent-ink);
}

/* =========================================================
   INNER PAGE HEADER AND BACK BUTTON
   ========================================================= */

#notes-root .page-header {
  position: relative;
}

#notes-root .page-header__back {
  display: inline-flex;
  min-height: 42px;
  align-items: center;
  gap: 8px;
  margin-bottom: 34px;
  padding: 9px 14px;
  border: 1px solid var(--hub-border);
  border-radius: var(--hub-radius-sm);
  background: transparent;
  color: var(--hub-text-secondary);
  font-size: 13px;
  font-weight: 650;
  cursor: pointer;
  transition:
    background 180ms ease,
    border-color 180ms ease,
    color 180ms ease;
}

#notes-root .page-header__back:hover {
  border-color: var(--hub-border-strong);
  background: var(--hub-surface-raised);
  color: var(--hub-accent);
}

#notes-root .page-header__back:active {
  transform: translateY(1px);
}

/* =========================================================
   ADVANCED TRAINING / TECHNIQUES
   ========================================================= */

#notes-root .techniques {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: start;
  gap: 20px;
}

#notes-root .technique {
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--hub-border);
  border-radius: var(--hub-radius-lg);
  background: var(--hub-surface);
}

#notes-root .technique__header {
  padding: clamp(20px, 2.5vw, 30px);
  border-bottom: 1px solid var(--hub-border);
  background:
    linear-gradient(135deg, rgba(110, 231, 183, 0.055), transparent 70%),
    var(--hub-surface);
}

#notes-root .technique__title {
  margin-bottom: 12px;
  color: var(--hub-accent);
  font-size: clamp(17px, 2vw, 22px);
  font-weight: 850;
  letter-spacing: 0.045em;
  line-height: 1.35;
}

#notes-root .technique__description {
  margin-bottom: 0;
  color: var(--hub-text-secondary);
  font-size: 13px;
  line-height: 1.85;
}

#notes-root .technique__body {
  display: grid;
  gap: 0;
  padding-inline: clamp(20px, 2.5vw, 30px);
}

#notes-root .technique__section {
  min-width: 0;
  padding-block: 24px;
}

#notes-root .technique__section + .technique__section {
  border-top: 1px solid var(--hub-border);
}

#notes-root .technique__section-title {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
  color: var(--hub-text);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

#notes-root .technique__section-title::before {
  width: 3px;
  height: 16px;
  flex: 0 0 auto;
  border-radius: 2px;
  background: var(--hub-accent);
  content: "";
}

#notes-root .technique-list {
  display: grid;
  gap: 11px;
  margin: 0;
  padding-left: 19px;
  color: var(--hub-text-secondary);
  font-size: 13px;
  line-height: 1.8;
}

#notes-root .technique-list__item {
  padding-left: 3px;
}

#notes-root .technique-list__item::marker {
  color: var(--hub-accent);
}

#notes-root .technique-list__item--group {
  padding-left: 2px;
  color: var(--hub-text);
}

#notes-root .technique-list__label {
  display: block;
  margin-bottom: 10px;
  font-weight: 700;
}

#notes-root .technique-list--nested {
  display: grid;
  gap: 8px;
  margin-top: 8px;
  padding-left: 20px;
  color: var(--hub-text-secondary);
}

/* =========================================================
   EVENTS / RACE SEQUENCE
   ========================================================= */

#notes-root .events {
  display: grid;
  gap: 36px;
  min-width: 0;
}

#notes-root .event {
  min-width: 0;
}

#notes-root .event__header {
  margin-bottom: 24px;
  padding: clamp(22px, 3vw, 34px);
  border: 1px solid var(--hub-border);
  border-radius: var(--hub-radius-lg);
  background:
    radial-gradient(
      ellipse at top right,
      rgba(110, 231, 183, 0.075),
      transparent 55%
    ),
    var(--hub-surface);
}

#notes-root .event__title {
  margin-bottom: 8px;
  color: var(--hub-accent);
  font-size: clamp(23px, 3vw, 34px);
  font-weight: 850;
  letter-spacing: -0.035em;
  line-height: 1.2;
}

#notes-root .event__subtitle {
  margin-bottom: 12px;
  color: var(--hub-text);
  font-size: 15px;
  font-weight: 650;
}

#notes-root .event__description {
  max-width: 850px;
  margin-bottom: 0;
  color: var(--hub-text-secondary);
  font-size: 13px;
  line-height: 1.9;
}

#notes-root .event-sequence {
  margin-bottom: 32px;
  padding: clamp(20px, 3vw, 30px);
  border: 1px solid var(--hub-border);
  border-radius: var(--hub-radius-lg);
  background: var(--hub-surface);
}

#notes-root .section-heading {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
}

#notes-root .section-heading h2,
#notes-root .section-heading h3 {
  margin-bottom: 0;
  color: var(--hub-text);
  font-size: 17px;
  font-weight: 800;
  letter-spacing: -0.015em;
}

#notes-root .section-heading::after {
  height: 1px;
  flex: 1;
  background: var(--hub-border);
  content: "";
}

#notes-root .event-sequence-list {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

#notes-root .event-sequence-item {
  display: flex;
  min-width: 0;
  min-height: 75px;
  align-items: center;
  gap: 11px;
  padding: 12px;
  border: 1px solid var(--hub-border);
  border-radius: var(--hub-radius-md);
  background: var(--hub-bg);
}

#notes-root .event-sequence-number {
  display: grid;
  width: 30px;
  height: 30px;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid var(--hub-border);
  border-radius: 50%;
  color: var(--hub-text-secondary);
  font-size: 11px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

#notes-root .event-sequence-item.is-run {
  border-left: 3px solid #78a9ff;
}

#notes-root .event-sequence-item.is-run .event-sequence-number {
  border-color: rgba(120, 169, 255, 0.4);
  color: #a9c9ff;
}

#notes-root .event-sequence-item.is-station {
  border-left: 3px solid var(--hub-accent);
}

#notes-root .event-sequence-item.is-station .event-sequence-number {
  border-color: rgba(110, 231, 183, 0.35);
  color: var(--hub-accent);
}

#notes-root .event-sequence-content {
  display: grid;
  min-width: 0;
  gap: 2px;
}

#notes-root .event-sequence-content strong {
  color: var(--hub-text);
  font-size: 12px;
  font-weight: 750;
  line-height: 1.4;
}

#notes-root .event-sequence-content span {
  color: var(--hub-text-muted);
  font-size: 12px;
}

/* =========================================================
   EVENT CATEGORIES AND DIVISIONS
   ========================================================= */

#notes-root .event-category {
  margin-top: 36px;
}

#notes-root .event-category__header {
  margin-bottom: 18px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--hub-border);
}

#notes-root .event-category__title {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
  color: var(--hub-text);
  font-size: clamp(22px, 3vw, 29px);
  font-weight: 800;
  letter-spacing: -0.035em;
  line-height: 1.3;
}

#notes-root .event-category__title::before {
  width: 4px;
  height: 25px;
  flex: 0 0 auto;
  border-radius: 3px;
  background: var(--hub-accent);
  content: "";
}

#notes-root .event-category__subtitle {
  margin-bottom: 8px;
  color: var(--hub-text);
  font-size: 14px;
  font-weight: 650;
}

#notes-root .event-category__description {
  max-width: 850px;
  margin-bottom: 8px;
  color: var(--hub-text-secondary);
  font-size: 13px;
  line-height: 1.8;
}

#notes-root .event-category__description:last-child {
  margin-bottom: 0;
}

#notes-root .division-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: start;
  gap: 16px;
}

#notes-root .division {
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--hub-border);
  border-radius: var(--hub-radius-md);
  background: var(--hub-surface);
}

#notes-root .division__header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 9px 12px;
  padding: 18px 20px;
  border-bottom: 1px solid var(--hub-border);
}

#notes-root .division__title {
  margin-bottom: 0;
  color: var(--hub-text);
  font-size: 15px;
  font-weight: 800;
  line-height: 1.45;
}

#notes-root .division__inherits {
  display: inline-flex;
  align-items: center;
  padding: 4px 8px;
  border: 1px solid rgba(110, 231, 183, 0.22);
  border-radius: 5px;
  background: var(--hub-accent-subtle);
  color: var(--hub-accent);
  font-size: 10px;
  font-weight: 750;
  line-height: 1.5;
}

/* =========================================================
   EVENT TABLES
   ========================================================= */

#notes-root .event-table-wrapper {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  overscroll-behavior-inline: contain;
  scrollbar-width: thin;
  scrollbar-color: var(--hub-border-strong) transparent;
}

#notes-root .event-table {
  width: 100%;
  min-width: 480px;
  border-collapse: collapse;
  border-spacing: 0;
  color: var(--hub-text-secondary);
  font-size: 12px;
  line-height: 1.65;
  text-align: left;
}

#notes-root .event-table th,
#notes-root .event-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--hub-border);
  vertical-align: top;
}

#notes-root .event-table th {
  background: var(--hub-bg);
  color: var(--hub-text-muted);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.065em;
  text-transform: uppercase;
  white-space: nowrap;
}

#notes-root .event-table td:first-child {
  color: var(--hub-text);
  font-weight: 650;
}

#notes-root .event-table tbody tr {
  transition: background 150ms ease;
}

#notes-root .event-table tbody tr:hover {
  background: var(--hub-surface-hover);
}

#notes-root .event-table tbody tr:last-child td {
  border-bottom: 0;
}

#notes-root .event-notes {
  display: grid;
  gap: 8px;
  padding: 14px 18px;
  border-top: 1px solid var(--hub-border);
  background: var(--hub-bg);
}

#notes-root .event-note {
  position: relative;
  margin-bottom: 0;
  padding-left: 16px;
  color: var(--hub-text-secondary);
  font-size: 12px;
  line-height: 1.7;
}

#notes-root .event-note::before {
  position: absolute;
  top: 0.65em;
  left: 0;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--hub-accent);
  content: "";
}

/* =========================================================
   NOTES AND EQUIPMENT
   ========================================================= */

#notes-root .notes {
  display: grid;
  gap: 32px;
  min-width: 0;
}

#notes-root .notes-section {
  min-width: 0;
}

#notes-root .notes-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

#notes-root .note-card {
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--hub-border);
  border-radius: var(--hub-radius-lg);
  background: var(--hub-surface);
}

#notes-root .note-card-header {
  padding: 23px 25px 20px;
  border-bottom: 1px solid var(--hub-border);
  background: linear-gradient(
    135deg,
    rgba(110, 231, 183, 0.05),
    transparent 80%
  );
}

#notes-root .note-card-type {
  display: block;
  margin-bottom: 10px;
  color: var(--hub-accent);
  font-size: 10px;
  font-weight: 850;
  letter-spacing: 0.15em;
}

#notes-root .note-card-header h3 {
  margin-bottom: 0;
  color: var(--hub-text);
  font-size: 19px;
  font-weight: 800;
  letter-spacing: -0.025em;
  line-height: 1.4;
}

#notes-root .note-list {
  display: grid;
  gap: 0;
  margin: 0;
  padding: 8px 25px 18px;
  list-style: none;
}

#notes-root .note-item {
  position: relative;
  padding: 12px 0 12px 22px;
  border-bottom: 1px solid var(--hub-border);
  color: var(--hub-text-secondary);
  font-size: 13px;
  line-height: 1.65;
}

#notes-root .note-item:last-child {
  border-bottom: 0;
}

#notes-root .note-item::before {
  position: absolute;
  top: 21px;
  left: 2px;
  width: 7px;
  height: 7px;
  border: 1px solid var(--hub-accent);
  border-radius: 2px;
  content: "";
  transform: rotate(45deg);
}

/* =========================================================
   RESPONSIVE — TABLETS
   ========================================================= */

@media (max-width: 1000px) {
  #notes-root {
    padding: clamp(22px, 4vw, 36px);
    margin: 2rem 0;
  }

  #notes-root .event-sequence-list {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  #notes-root .techniques {
    gap: 14px;
  }

  #notes-root .division-grid {
    gap: 12px;
  }
}

/* =========================================================
   RESPONSIVE — SMALL TABLETS AND LARGE PHONES
   ========================================================= */

@media (max-width: 720px) {
  #notes-root .dashboard-grid,
  #notes-root .techniques,
  #notes-root .division-grid,
  #notes-root .notes-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  #notes-root .dashboard-tile {
    min-height: 205px;
  }

  #notes-root .dashboard-tile__title {
    margin-top: 28px;
  }

  #notes-root .event-sequence-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  #notes-root .dashboard-header,
  #notes-root .page-header {
    margin-bottom: 32px;
  }

  #notes-root .page-header__back {
    margin-bottom: 26px;
  }

  #notes-root .event-category {
    margin-top: 28px;
  }

  #notes-root .event__header,
  #notes-root .event-sequence {
    padding: 20px;
  }
}

/* =========================================================
   RESPONSIVE — MOBILE PHONES
   ========================================================= */

@media (max-width: 480px) {
  #notes-root {
    width: 90vw;
  }

  #notes-root .dashboard-header__title,
  #notes-root .page-header__title {
    font-size: clamp(32px, 10vw, 43px);
    letter-spacing: -0.045em;
  }

  #notes-root .dashboard-header__eyebrow,
  #notes-root .page-header__eyebrow {
    font-size: 10px;
  }

  #notes-root .dashboard-grid {
    gap: 12px;
  }

  #notes-root .dashboard-tile {
    min-height: 190px;
    padding: 22px 20px;
    border-radius: var(--hub-radius-md);
  }

  #notes-root .dashboard-tile__title {
    margin-top: 24px;
    font-size: 16px;
  }

  #notes-root .dashboard-tile__description {
    max-width: calc(100% - 4px);
    padding-right: 0;
    font-size: 12px;
  }

  #notes-root .dashboard-tile__arrow {
    right: 17px;
    bottom: 17px;
    width: 30px;
    height: 30px;
  }

  #notes-root .technique__header,
  #notes-root .technique__body {
    padding-inline: 19px;
  }

  #notes-root .technique__section {
    padding-block: 21px;
  }

  #notes-root .event__header {
    padding: 20px 18px;
  }

  #notes-root .event-sequence {
    padding: 17px 13px;
  }

  #notes-root .event-sequence-list {
    gap: 8px;
  }

  #notes-root .event-sequence-item {
    min-height: 68px;
    gap: 8px;
    padding: 9px 8px;
  }

  #notes-root .event-sequence-number {
    width: 25px;
    height: 25px;
    font-size: 10px;
  }

  #notes-root .event-sequence-content strong,
  #notes-root .event-sequence-content span {
    font-size: 11px;
  }

  #notes-root .event-category__title {
    font-size: 23px;
  }

  #notes-root .division__header {
    padding: 15px;
  }

  #notes-root .event-table {
    min-width: 450px;
    font-size: 11px;
  }

  #notes-root .event-table th,
  #notes-root .event-table td {
    padding: 10px 11px;
  }

  #notes-root .note-card-header {
    padding: 20px 19px 17px;
  }

  #notes-root .note-list {
    padding-inline: 19px;
  }

  #notes-root .page-header__back {
    margin-bottom: 25px;
  }
}

/* =========================================================
   ACCESSIBILITY — REDUCED MOTION
   ========================================================= */

@media (prefers-reduced-motion: reduce) {
  #notes-root *,
  #notes-root *::before,
  #notes-root *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
