/* VF Tool Guide scoped styles */

/* Define custom properties for the guide, using main site's variables with fallback */
.vf-guide {
  --guide-bg: var(--paper, #f5f3fb);
  --guide-text: var(--ink, #1a1533);
  --guide-muted: var(--muted, #6b657f);
  --guide-line: var(--line, #d9d5e8);
  --guide-gold: var(--vf-gold, #b8860b);
  --guide-btn-bg: var(--btn, #2a2456);
  --guide-btn-text: #ffffff;
  --guide-card-bg: var(--white, #ffffff);
  --guide-shadow: 0 4px 12px rgba(0,0,0,0.05);

  background-color: var(--guide-bg);
  color: var(--guide-text);
  font-size: 16px;
  line-height: 1.6;
  max-width: 960px;
  margin: 0 auto;
  padding: 1rem;
  box-sizing: border-box;
}

@media (prefers-color-scheme: dark) {
  .vf-guide {
    --guide-bg: var(--paper, #12101c);
    --guide-text: var(--ink, #eae6f5);
    --guide-muted: var(--muted, #9b94b5);
    --guide-line: var(--line, #38324f);
    --guide-gold: var(--vf-gold, #d4af37);
    --guide-btn-bg: var(--btn, #3f3a6b);
    --guide-btn-text: #ffffff;
    --guide-card-bg: var(--white, #1d1a2e);
    --guide-shadow: 0 4px 12px rgba(0,0,0,0.3);
  }
}

/* Ensure all elements within scope use border-box */
.vf-guide *,
.vf-guide *::before,
.vf-guide *::after {
  box-sizing: border-box;
}

/* General button, input, select min-height */
.vf-guide button,
.vf-guide select,
.vf-guide input,
.vf-guide textarea {
  min-height: 44px;
  font-size: 16px;
}

/* Hidden attribute */
.vf-guide [hidden] {
  display: none !important;
}

/* Container */
.vf-guide-container {
  width: 100%;
}

/* Non-collapsed title */
.vf-guide-title {
  margin: 0 0 1rem;
  font-size: 1.75rem;
}

/* Collapsed details */
.vf-guide-details {
  border: 1px solid var(--guide-line);
  border-radius: 0.5rem;
  overflow: hidden;
}

.vf-guide-summary {
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  height: 44px;
  padding: 0 1rem;
  background: var(--guide-bg);
  font-weight: 600;
}

.vf-guide-summary::-webkit-details-marker {
  display: none;
}

.vf-guide-summary::before {
  content: "\25B6";
  margin-right: 0.5rem;
  transition: none;
}

.vf-guide-details[open] .vf-guide-summary::before {
  content: "\25BC";
}

.vf-guide-details-content {
  padding: 0 1rem 1rem;
}

/* Form */
.vf-guide-form {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
}

.vf-guide-fieldset {
  border: none;
  padding: 0;
  margin: 0;
}

.vf-guide-legend {
  font-weight: 600;
  font-size: 16px;
  margin-bottom: 0.5rem;
}

.vf-guide-select {
  width: 100%;
  padding: 0.5rem;
  border: 1px solid var(--guide-line);
  border-radius: 0.5rem;
  background: var(--guide-card-bg);
  color: var(--guide-text);
}

.vf-guide-submit {
  width: 100%;
  background: var(--guide-btn-bg);
  color: var(--guide-btn-text);
  border: 1px solid var(--guide-gold);
  border-radius: 0.5rem;
  font-weight: 600;
  cursor: pointer;
  grid-column: 1 / -1;
}

.vf-guide-error {
  color: #b00020;
  font-size: 16px;
  grid-column: 1 / -1;
}

.vf-guide-results {
  grid-column: 1 / -1;
  margin-top: 1rem;
}

.vf-guide-results-heading {
  margin: 0 0 0.5rem;
  font-size: 1.5rem;
  outline: none;
}

.vf-guide-results-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.vf-guide-result-card {
  background: var(--guide-card-bg);
  border: 1px solid var(--guide-line);
  border-radius: 0.5rem;
  padding: 1rem;
  margin-bottom: 0.75rem;
  box-shadow: var(--guide-shadow);
}

.vf-guide-result-name {
  margin: 0 0 0.5rem;
  font-size: 1.25rem;
}

.vf-guide-result-why,
.vf-guide-result-needs,
.vf-guide-result-result {
  margin: 0.25rem 0;
  font-size: 16px;
}

.vf-guide-result-note {
  font-size: 16px;
  color: var(--guide-muted);
  font-style: italic;
}

.vf-guide-result-link {
  display: inline-block;
  min-height: 44px;
  line-height: 44px;
  padding: 0 1rem;
  background: var(--guide-btn-bg);
  color: var(--guide-btn-text);
  text-decoration: none;
  border-radius: 0.5rem;
  margin-top: 0.5rem;
  border: 1px solid var(--guide-line);
}

/* Responsive: 2 columns for expanded form on desktop */
@media (min-width: 600px) {
  .vf-guide-details[open] .vf-guide-form {
    grid-template-columns: 1fr 1fr;
  }
  .vf-guide-details[open] .vf-guide-submit,
  .vf-guide-details[open] .vf-guide-error,
  .vf-guide-details[open] .vf-guide-results {
    grid-column: 1 / -1;
  }
}

/* Ensure collapsed summary height is narrow */
@media (max-width: 599px) {
  .vf-guide-details:not([open]) .vf-guide-summary {
    height: 44px;
  }
}

@media (min-width: 390px) {
  .vf-guide {
    padding: 1.25rem;
  }
}

@media (min-width: 1440px) {
  .vf-guide {
    padding: 2rem;
  }
}
@media (prefers-color-scheme: dark) {
  .vf-guide {
    --guide-btn-text: #14162b;
  }
}
