:root {
  --color-bg: hsl(79deg 100% 2.94%);
  --color-surface: hsl(79deg 100% 6.12%);
  --color-surface-elevated: hsl(79deg 87.83% 9.86%);
  --color-border: hsl(79deg 87.83% 9.86%);
  --color-text: hsl(79deg 25% 92%);
  --color-text-muted: hsl(79deg 20% 72%);
  --color-accent: hsl(79.35deg 100% 29.19%);
  --color-accent-hover: hsl(79deg 100% 35%);
  --font-sans: system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  --font-mono: ui-monospace, monospace;
  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.4);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.4);
}

*, *::before, *::after { box-sizing: border-box; }

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
}

body {
  margin: 0;
  font-family: var(--font-sans);
  background: var(--color-bg);
  color: var(--color-text);
  min-height: 100vh;
  line-height: 1.5;
}

a:visited {
  color: hsl(84deg 25% 92.16%);
}

.app-nav {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  background: hsl(79deg 100% 4.2%);
  border-bottom: 1px solid var(--color-border);
}

.app-nav a {
  color: var(--color-accent);
  text-decoration: none;
  font-weight: 500;
}

.app-nav a:hover {
  color: var(--color-accent-hover);
}

.app-nav__stable {
  font-weight: 600;
  padding: var(--space-1) var(--space-2);
  border-radius: var(--radius-md);
  background: var(--color-accent);
  color: var(--color-bg);
}

.app-nav__stable:hover {
  background: var(--color-accent-hover);
  color: var(--color-bg);
}

.app-back-link {
  display: inline-block;
  padding: var(--space-2) var(--space-3);
  color: var(--color-accent);
  text-decoration: none;
  font-weight: 500;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: transparent;
}

.app-back-link:hover {
  color: var(--color-accent-hover);
  border-color: var(--color-accent);
}

.app-back-link--button {
  background: var(--color-accent);
  color: var(--color-bg);
  border-color: var(--color-accent);
}

.app-back-link--button:hover {
  background: var(--color-accent-hover);
  color: var(--color-bg);
  border-color: var(--color-accent-hover);
}

.horse-detail-nav-row {
  margin: 0 calc(-1 * var(--space-4)) var(--space-4);
  padding: var(--space-3) var(--space-4);
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--color-surface-elevated);
  border-bottom: 1px solid var(--color-border);
}

.horse-detail-nav-row .app-back-link {
  display: inline-block;
}

.app-breadcrumb {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-wrap: wrap;
}

.app-breadcrumb a {
  color: var(--color-accent);
  text-decoration: none;
  font-weight: 500;
}

.app-breadcrumb a:hover {
  color: var(--color-accent-hover);
}

.app-breadcrumb__sep {
  color: var(--color-text-muted);
  font-weight: 400;
}

.app-shell {
  max-width: 1200px;
  margin: 0 auto;
  padding: var(--space-5) var(--space-4);
}

.app-shell h1 {
  margin: 0 0 var(--space-4);
  font-size: 1.5rem;
  font-weight: 600;
}

.horse-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: var(--space-4);
}

.horse-card {
  background: var(--color-surface-elevated);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.2s, border-color 0.2s;
}

.horse-card:hover {
  box-shadow: var(--shadow-md);
  border-color: var(--color-accent);
}

.horse-card__image {
  width: 100%;
  aspect-ratio: 4/3;
  background: var(--color-surface);
  object-fit: cover;
}

.horse-card__image--placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-text-muted);
  font-size: 0.875rem;
}

.horse-card__body {
  padding: var(--space-3);
}

.horse-card__name {
  margin: 0;
  font-weight: 600;
  font-size: 1rem;
}

.horse-card__registered {
  margin: 0 0 var(--space-1);
  font-size: 0.875rem;
  color: var(--color-text-muted);
}

.horse-card__meta {
  margin: var(--space-1) 0 0;
  font-size: 0.875rem;
  color: var(--color-text-muted);
}

.stable-list-wrap {
  min-height: 120px;
}

.stable-empty {
  text-align: center;
  padding: var(--space-6);
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  border: 1px dashed var(--color-border);
  color: var(--color-text-muted);
}

.stable-empty p {
  margin: 0 0 var(--space-3);
}

.horse-detail__subtitle {
  margin: 0 0 var(--space-4);
  font-size: 1rem;
  color: var(--color-text-muted);
}

.horse-detail__meta {
  display: grid;
  gap: var(--space-2);
  margin-bottom: var(--space-4);
}

.horse-detail__row {
  margin: 0;
  display: flex;
  gap: var(--space-2);
  flex-wrap: wrap;
}

.horse-detail__label {
  font-weight: 600;
  color: var(--color-text-muted);
  min-width: 7rem;
}

.horse-detail__photo {
  max-width: 100%;
  margin-top: var(--space-4);
  border-radius: var(--radius-md);
}

.horse-detail-edit-wrap {
  display: none;
}

.horse-detail-content.horse-detail-content--editing .horse-detail-display {
  display: none;
}

.horse-detail-content.horse-detail-content--editing .horse-detail-edit-wrap {
  display: block;
}

.horse-detail-edit-form {
  margin-top: var(--space-4);
  padding-top: var(--space-4);
  border-top: 1px solid var(--color-border);
  max-width: 32rem;
}

.horse-detail-photo-section {
  margin-top: var(--space-5);
  padding-top: var(--space-4);
  border-top: 1px solid var(--color-border);
}

.horse-detail-upload-label {
  display: inline-block;
  padding: var(--space-2) var(--space-4);
  background: var(--color-accent);
  color: var(--color-bg);
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: 0.9375rem;
  cursor: pointer;
  border: none;
  transition: background 0.2s;
}

.horse-detail-upload-label:hover {
  background: var(--color-accent-hover);
}

.form-group {
  margin-bottom: var(--space-4);
}

.form-group label {
  display: block;
  margin-bottom: var(--space-1);
  font-size: 0.875rem;
  color: var(--color-text-muted);
}

.form-group input,
.form-group textarea {
  width: 100%;
  max-width: 400px;
  padding: var(--space-2) var(--space-3);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  color: var(--color-text);
  font-family: inherit;
  font-size: 1rem;
}

.form-group input:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--color-accent);
}

.page-section {
  margin-bottom: var(--space-5);
}

.page-section h2 {
  margin: 0 0 var(--space-3);
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--color-text-muted);
}

.btn-oauth {
  display: inline-block;
  padding: var(--space-2) var(--space-4);
  background: hsl(79deg 100% 26.23%);
  border: 1px solid hsl(79deg 100% 27.55%);
  border-radius: var(--radius-md);
  color: var(--color-text);
  text-decoration: none;
  font-weight: 500;
  font-size: 0.875rem;
  transition: border-color 0.2s, background 0.2s;
}

.btn-oauth:hover {
  border-color: var(--color-accent);
  background: var(--color-surface);
}

.landing {
  max-width: 100%;
  position: relative;
  background: hsl(79deg 100% 2.94%);
}

.landing::before {
  content: "";
  position: fixed;
  inset: 0;
  background-image: url("/assets/horse.png");
  background-size: 280px auto;
  background-repeat: no-repeat;
  background-position: 90% 20%;
  opacity: 0.04;
  pointer-events: none;
  z-index: 0;
}

.landing > * {
  position: relative;
  z-index: 1;
}

.landing-hero {
  display: grid;
  grid-template-columns: 1fr minmax(280px, 1fr);
  gap: var(--space-6);
  align-items: start;
  padding: var(--space-6) var(--space-4);
  max-width: 1200px;
  margin: 0 auto;
}

.landing-hero-content {
  min-width: 0;
  overflow-wrap: break-word;
}

@media (max-width: 768px) {
  .landing-hero {
    grid-template-columns: 1fr;
    text-align: center;
  }
  .landing-hero-image {
    justify-self: center !important;
    max-width: 100% !important;
    border-radius: .1em !important;
  }
}

.landing-hero-title {
  margin: 0 0 var(--space-4);
  font-size: clamp(1.75rem, 4vw, 2.25rem);
  font-weight: 700;
  line-height: 1.2;
  color: hsl(79.32deg 100% 71.37%);
}

.landing-hero-sub {
  margin: 0 0 var(--space-5);
  font-size: 1.125rem;
  color: var(--color-text-muted);
  max-width: 480px;
}

@media (max-width: 768px) {
  .landing-hero-sub {
    margin-left: auto;
    margin-right: auto;
  }
}

.landing-hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
}

@media (max-width: 768px) {
  .landing-hero-actions {
    justify-content: center;
  }
}

.landing-btn {
  display: inline-block;
  padding: var(--space-3) var(--space-5);
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: 1rem;
  text-decoration: none;
  transition: background 0.2s, border-color 0.2s;
}

.landing-btn-primary {
  background: hsl(79.35deg 100% 29.19%);
  color: var(--color-bg);
  border: none;
}

.landing-btn-primary:hover {
  background: var(--color-accent-hover);
}

.landing-btn-secondary {
  background: transparent;
  color: var(--color-accent);
  border: 2px solid var(--color-accent);
}

.landing-btn-secondary:hover {
  background: var(--color-surface-elevated);
}

.landing-hero-image {
  aspect-ratio: 4/3;
  max-width: 620px;
  justify-self: end;
  border-radius: var(--radius-lg);
  border: 1px solid hsl(79deg 6% 41.6%);
  overflow: hidden;
  min-height: 400px;
  position: relative;
  background: var(--color-surface);
}

.landing-hero-image::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    135deg,
    rgba(15, 15, 18, 0.75) 0%,
    transparent 50%,
    rgba(15, 15, 18, 0.2) 100%
  );
  pointer-events: none;
}

.landing-hero-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  display: block;
}

.landing-section {
  position: relative;
  padding: var(--space-6) var(--space-4);
  max-width: 1200px;
  margin: 0.5em auto;
  background: hsl(79deg 100% 6.12%);
  border: 1px solid hsl(79deg 87.83% 9.86%);
  border-radius: 0.25em;
}

.landing-section::before {
  content: "";
  position: absolute;
  right: var(--space-4);
  top: 50%;
  transform: translateY(-50%);
  width: 120px;
  height: 120px;
  background-image: url("/assets/horse.png");
  background-size: contain;
  background-repeat: no-repeat;
  opacity: 0.06;
  pointer-events: none;
  z-index: 0;
}

@media (max-width: 768px) {
  .landing-section::before {
    width: 80px;
    height: 80px;
    right: var(--space-2);
  }
}

.landing-section-title {
  margin: 0 0 var(--space-3);
  font-size: 1.5rem;
  font-weight: 600;
}

.landing-section-text {
  margin: 0;
  font-size: 1.0625rem;
  color: var(--color-text-muted);
  max-width: 640px;
  line-height: 1.6;
}

.landing-cta {
  text-align: center;
}

.landing-cta::before {
  display: none;
}

.landing-cta .landing-section-title,
.landing-cta .landing-section-text {
  margin-left: auto;
  margin-right: auto;
}

.landing-cta .landing-section-text {
  margin-bottom: var(--space-4);
}

.landing-cta .landing-btn {
  margin-top: var(--space-2);
}
