/* freefall.css — Acceleration of Free Fall simulation
   Follows the SimpliPhys GCSE simulation layout pattern:
   centred max-width container, floating white panel cards on a tinted page.
*/

/* ===== CSS CUSTOM PROPERTIES ===== */
:root {
  --navy:     #2c3e50;
  --softgray: #ecf0f1;
  --teal:     #1abc9c;
  --gold:     #f1c40f;
  --slate:    #7f8c8d;
  --coral:    #e74c3c;
  --white:    #ffffff;
  --bg:       #f0f4f8;
  --card:     #ffffff;
  --border:   #dde3ea;
  --gray-100: #f7fafc;
  --gray-200: #edf2f7;
  --gray-300: #e2e8f0;
}

/* ===== RESET / BASE ===== */
*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }

body {
  font-family: 'Montserrat', system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background: var(--bg);
  color: var(--navy);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ===== ACCESSIBILITY ===== */
.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--navy);
  color: #fff;
  padding: 8px 16px;
  z-index: 1000;
  font-size: 0.9rem;
  text-decoration: none;
}
.skip-link:focus { left: 8px; top: 8px; }

/* ===== LAYOUT ===== */
.main-content {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.container {
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
  padding: 24px 20px;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* ===== PAGE HEADER ===== */
.page-header {
  text-align: center;
  color: var(--navy);
}

.header-grid {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 12px;
  padding: 4px 0;
}

.header-left    { justify-self: start; }
.header-actions { justify-self: end; }

.page-title {
  margin: 0;
  justify-self: center;
  font-size: clamp(1.3rem, 3vw, 2rem);
  font-weight: 700;
  font-family: 'Montserrat', sans-serif;
}

/* ===== INSTRUCTIONS CALLOUT ===== */
.instructions {
  background: rgba(26, 188, 156, 0.1);
  border: 2px solid var(--teal);
  border-radius: 10px;
  padding: 14px 20px;
  text-align: center;
  color: var(--navy);
  font-size: 0.9rem;
  line-height: 1.6;
}

/* ===== TAB BAR ===== */
.tab-bar {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
}

.tab-btn {
  padding: 10px 22px;
  border: 2px solid var(--border);
  border-radius: 999px;
  background: var(--card);
  color: var(--slate);
  font-family: 'Montserrat', sans-serif;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s, box-shadow 0.15s;
  line-height: 1.3;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.tab-btn:hover { color: var(--navy); border-color: var(--slate); }

.tab-btn.active {
  background: var(--teal);
  color: var(--white);
  border-color: var(--teal);
}

.tab-btn[data-method="method2"].active {
  background: var(--gold);
  color: var(--navy);
  border-color: var(--gold);
}

/* ===== METHOD PANELS ===== */
.method-panel {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.method-panel[hidden] { display: none; }

/* ===== PANEL CARD ===== */
.panel {
  background: var(--card);
  border-radius: 12px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
  overflow: hidden;
}

/* ===== TWO-PANEL APPARATUS LAYOUT ===== */
.sim-layout {
  display: grid;
  grid-template-columns: 3fr 2fr;
  gap: 20px;
  align-items: start;
}

/* Apparatus card — canvas centred */
.apparatus-panel {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 16px;
}

.apparatus-panel canvas {
  display: block;
  max-width: 100%;
  height: auto;
  border-radius: 8px;
  touch-action: none;
}

/* Controls card */
.controls-panel {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.control-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.ctrl-label {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--slate);
}

.range-input {
  width: 100%;
  -webkit-appearance: none;
  appearance: none;
  height: 4px;
  border-radius: 2px;
  background: var(--gray-300);
  outline: none;
  cursor: pointer;
}

.range-input::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--teal);
  cursor: pointer;
  box-shadow: 0 0 0 3px rgba(26, 188, 156, 0.2);
}

.range-input::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--teal);
  cursor: pointer;
  border: none;
}

.range-input-gold::-webkit-slider-thumb {
  background: var(--gold);
  box-shadow: 0 0 0 3px rgba(241, 196, 15, 0.2);
}

.range-input-gold::-moz-range-thumb { background: var(--gold); }

.range-hint {
  margin: 0;
  font-size: 0.78rem;
  color: var(--slate);
  line-height: 1.5;
}

.button-stack {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.reading-hint {
  margin: 0;
  padding: 12px 14px;
  background: rgba(26, 188, 156, 0.08);
  border-left: 4px solid var(--teal);
  border-radius: 0 8px 8px 0;
  font-size: 0.8rem;
  color: var(--navy);
  line-height: 1.5;
}

.reading-hint.gold {
  background: rgba(241, 196, 15, 0.1);
  border-left-color: var(--gold);
}

/* ===== SELECT INPUT ===== */
.select-input {
  width: 100%;
  background: var(--white);
  border: 1.5px solid var(--gray-300);
  border-radius: 6px;
  color: var(--navy);
  font-family: 'Montserrat', sans-serif;
  font-size: 0.85rem;
  font-weight: 500;
  padding: 9px 28px 9px 10px;
  outline: none;
  cursor: pointer;
  transition: border-color 0.15s;
  -webkit-appearance: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%237F8C8D' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
}

.select-input:focus { border-color: var(--gold); }

/* ===== BUTTONS ===== */
.btn {
  display: inline-block;
  border: 1px solid transparent;
  padding: 11px 22px;
  border-radius: 0.375rem;
  cursor: pointer;
  font-weight: 600;
  font-family: 'Montserrat', sans-serif;
  font-size: 0.9rem;
  text-align: center;
  transition: all 0.2s;
}

.btn:active   { transform: translateY(1px); opacity: 0.95; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

.teal-btn  { background: rgba(26, 188, 156, 0.8); color: var(--white); }
.teal-btn:hover:not(:disabled)  { background: rgba(26, 188, 156, 0.7); transform: translateY(-2px); }

.gold-btn  { background: rgba(241, 196, 15, 0.9); color: var(--navy); }
.gold-btn:hover:not(:disabled)  { background: rgba(241, 196, 15, 0.6); transform: translateY(-2px); }

.navy-btn  { background: rgba(44, 62, 80, 0.8); color: var(--white); }
.navy-btn:hover:not(:disabled)  { background: rgba(44, 62, 80, 0.7); transform: translateY(-2px); }

.coral-btn { background: rgba(231, 76, 60, 0.8); color: var(--white); }
.coral-btn:hover:not(:disabled) { background: rgba(231, 76, 60, 0.7); transform: translateY(-2px); }

.outline-btn {
  background: transparent;
  color: var(--slate);
  border: 1.5px solid var(--gray-300);
}
.outline-btn:hover:not(:disabled) { color: var(--navy); border-color: var(--slate); }

.small { padding: 7px 14px; font-size: 0.78rem; }

/* ===== RESULTS PANEL ===== */
.results-panel {
  padding: 20px;
}

.results-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
  gap: 12px;
  flex-wrap: wrap;
}

.results-title {
  font-size: 1.05rem;
  font-weight: 700;
  margin: 0;
  color: var(--navy);
}

.results-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.table-wrap { overflow-x: auto; }

.results-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

.results-table th {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--slate);
  padding: 8px 10px;
  text-align: left;
  border: 1px solid var(--border);
  white-space: nowrap;
  background: var(--gray-100);
}

.results-table td {
  padding: 3px 4px;
  border: 1px solid var(--border);
}

.results-table td input {
  width: 100%;
  background: transparent;
  border: 1.5px solid transparent;
  border-radius: 4px;
  color: var(--navy);
  font-family: 'Montserrat', sans-serif;
  font-size: 0.85rem;
  padding: 6px 8px;
  outline: none;
  transition: border-color 0.15s, background 0.15s;
  min-width: 70px;
}

.results-table td input:focus {
  border-color: var(--teal);
  background: rgba(26, 188, 156, 0.06);
}

.results-table td input:hover { border-color: var(--gray-300); }

/* ===== GUIDED INVESTIGATION ===== */
.gi-outer {
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
}

.gi-details { background: var(--card); }

.gi-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  cursor: pointer;
  list-style: none;
  user-select: none;
  gap: 12px;
  background: var(--navy);
  color: #fff;
  transition: background 0.2s;
}

.gi-summary::-webkit-details-marker { display: none; }
.gi-summary::marker { display: none; }
.gi-summary:hover { background: #34495e; }

.gi-summary-title {
  font-size: 0.95rem;
  font-weight: 700;
  font-family: 'Montserrat', sans-serif;
}

.gi-summary-chevron {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  transition: transform 0.3s ease;
}

.gi-details[open] .gi-summary-chevron { transform: rotate(180deg); }

.gi-body {
  padding: 8px 28px 28px;
  display: flex;
  flex-direction: column;
  gap: 0;
}

.gi-intro {
  margin: 20px 0 0;
  color: var(--slate);
  font-size: 0.88rem;
  line-height: 1.7;
  max-width: 820px;
}

.gi-part {
  margin-top: 24px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--gray-200);
}

.gi-part--last { border-bottom: none; padding-bottom: 0; }

.gi-part-heading {
  font-size: 0.92rem;
  font-weight: 700;
  margin: 0 0 14px;
  letter-spacing: 0.01em;
}

.gi-part-heading--teal { color: var(--teal); }
.gi-part-heading--gold { color: #c49a00; }   /* darkened gold for white-bg readability */
.gi-part-heading--navy { color: var(--navy); }

.gi-part-intro {
  margin: 0 0 12px;
  color: var(--navy);
  font-size: 0.86rem;
  line-height: 1.65;
}

.gi-list {
  margin: 0 0 12px 0;
  padding-left: 20px;
  color: var(--navy);
  font-size: 0.86rem;
  line-height: 1.8;
}

.gi-list li { margin-bottom: 4px; }

.gi-prompt {
  margin-top: 14px;
  padding: 12px 14px;
  background: var(--gray-100);
  border-radius: 7px;
  border-left: 3px solid var(--gray-300);
}

.gi-part:nth-child(2) .gi-prompt { border-left-color: rgba(26, 188, 156, 0.5); }
.gi-part:nth-child(3) .gi-prompt { border-left-color: rgba(26, 188, 156, 0.5); }
.gi-part:nth-child(4) .gi-prompt { border-left-color: rgba(241, 196, 15, 0.6); }
.gi-part:nth-child(5) .gi-prompt { border-left-color: rgba(44, 62, 80, 0.3); }

.gi-prompt-label {
  font-size: 0.82rem;
  font-weight: 700;
  margin: 0 0 6px;
  color: var(--navy);
  display: inline;
}

.gi-prompt p {
  display: inline;
  margin: 0;
  color: var(--slate);
  font-size: 0.84rem;
  line-height: 1.7;
}

.gi-prompt > h4 + p::before { content: ' '; }

/* ===== FOOTER ===== */
.site-footer {
  background: var(--navy);
  color: #fff;
  text-align: center;
  padding: 16px;
  font-size: 0.8rem;
}

.site-footer p { margin: 0; }

/* ===== RESPONSIVE ===== */
@media (max-width: 800px) {
  .sim-layout {
    grid-template-columns: 1fr;
  }

  .container {
    padding: 16px 12px;
  }

  .results-header {
    flex-direction: column;
    align-items: flex-start;
  }
}

@media (max-width: 540px) {
  .header-grid {
    grid-template-columns: 1fr;
    grid-auto-flow: row;
    text-align: left;
  }

  .header-left    { justify-self: start; }
  .page-title     { justify-self: start; }
  .header-actions { display: none; }

  .tab-btn { font-size: 0.75rem; padding: 9px 16px; }

  .gi-body { padding: 8px 16px 20px; }
}

/* ===== REDUCED MOTION ===== */
@media (prefers-reduced-motion: reduce) {
  .gi-summary-chevron,
  .gi-summary,
  .btn,
  .tab-btn { transition: none; }
}
