/* HTTP Caching Explainer: builds on /labs/csp/tool.css. */

.jump-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 22px;
}
.jump-links a {
  border: 1px solid #35465d;
  border-radius: 999px;
  padding: 6px 14px;
  font-size: 0.85rem;
  color: #c4d2e2;
}
.jump-links a:hover {
  border-color: var(--mint);
}
.section-title {
  font-size: 1.35rem;
  margin: 44px 0 16px;
  scroll-margin-top: 90px;
}
.cache-main h2[id],
.cache-main h3[id] {
  scroll-margin-top: 90px;
}

/* Layer cards */
.layers {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(320px, 100%), 1fr));
  gap: 16px;
  margin-top: 22px;
}
.layer-card {
  min-width: 0;
  border: 1px solid #34465c;
  border-radius: 10px;
  padding: 18px 20px;
  background: #0e192b;
}
.layer-card[data-stores="false"] {
  border-color: #6b4a55;
}
.layer-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 4px 12px;
}
.layer-head h3 {
  margin: 0;
  font-size: 1.1rem;
}
.layer-sub {
  color: var(--muted);
  font-size: 0.78rem;
}
.layer-verdict {
  font-size: 1rem;
  line-height: 1.5;
  margin: 10px 0 12px;
}
.layer-facts {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  gap: 6px 14px;
  margin: 0 0 14px;
  font-size: 0.85rem;
}
.layer-facts dt {
  color: var(--muted);
}
.layer-facts dd {
  margin: 0;
  overflow-wrap: anywhere;
}
.layer-note {
  color: #c9b98f;
  font-size: 0.82rem;
  line-height: 1.5;
  margin: 10px 0 0;
}

/* Timeline */
.timeline {
  display: flex;
  height: 14px;
  border-radius: 7px;
  overflow: hidden;
  background: #1a2840;
}
.segment {
  flex: 0 0 auto;
  flex-basis: 0;
  min-width: 3px;
}
.segment.fresh,
.timeline-legend .fresh .swatch {
  background: #53e3bd;
}
.segment.stale-served,
.timeline-legend .stale-served .swatch {
  background: #e7b94f;
}
.segment.check,
.timeline-legend .check .swatch {
  background: #6c7f9b;
}
.timeline-scale {
  display: flex;
  justify-content: space-between;
  color: var(--muted);
  font-size: 0.72rem;
  margin-top: 4px;
}
.timeline-legend {
  list-style: none;
  padding: 0;
  margin: 10px 0 0;
  display: flex;
  flex-wrap: wrap;
  gap: 6px 16px;
  font-size: 0.8rem;
  color: #c4d2e2;
}
.timeline-legend li {
  display: flex;
  align-items: center;
  gap: 6px;
}
.swatch {
  width: 10px;
  height: 10px;
  border-radius: 3px;
  flex: none;
}

/* Findings and breakdown additions */
.finding-links {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 16px;
  margin: 8px 0 0;
  font-size: 0.82rem;
}
.finding-links a {
  color: var(--mint);
  text-decoration: underline;
  text-underline-offset: 3px;
}
.status-finding .finding-head code {
  overflow-wrap: anywhere;
}
.card-head > code {
  overflow-wrap: anywhere;
}
.card-summary.muted {
  color: var(--muted);
}
.problem-note {
  display: block;
  color: #f0a3a3;
  font-size: 0.8rem;
}
.inline-more {
  color: var(--mint);
  font-size: 0.8rem;
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* Builder */
.builder,
.quiz {
  border-top: 1px solid var(--line);
  margin-top: 56px;
  padding-top: 40px;
}
.builder h2,
.quiz h2 {
  margin: 8px 0 10px;
  font-size: clamp(1.6rem, 3vw, 2.2rem);
}
.scenarios {
  border: 0;
  padding: 0;
  margin: 18px 0 0;
  min-width: 0;
}
.scenarios legend {
  font-weight: 600;
  margin-bottom: 10px;
}
#scenarios {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(260px, 100%), 1fr));
  gap: 8px;
}
.scenario {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  border: 1px solid #34465c;
  border-radius: 8px;
  padding: 12px 14px;
  background: #0e192b;
  cursor: pointer;
  font-size: 0.9rem;
  line-height: 1.4;
}
.scenario:has(input:checked) {
  border-color: var(--mint);
  background: #0f2230;
}
.scenario input {
  margin-top: 3px;
  accent-color: var(--mint);
}
.build-form .field select,
.build-form .field input {
  min-width: 0;
}
.build-output {
  margin-top: 24px;
}
.build-output h3 {
  font-size: 1rem;
  margin: 20px 0 8px;
}
.code-block {
  margin: 0;
  padding: 14px 16px;
  border: 1px solid #2d3e56;
  border-radius: 8px;
  background: #07101f;
  color: #dfe7f2;
  font:
    0.84rem/1.6 "IBM Plex Mono",
    ui-monospace,
    SFMono-Regular,
    Menlo,
    monospace;
  overflow-x: auto;
  white-space: pre;
}
.reason-list {
  margin: 0;
  padding-left: 20px;
  color: #c4d2e2;
  line-height: 1.6;
  font-size: 0.92rem;
}
.reason-list li + li {
  margin-top: 4px;
}
.snippet-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.snippet-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* Quiz */
.quiz-start {
  margin-top: 18px;
}
.quiz-card,
.quiz-done {
  margin-top: 20px;
  border: 1px solid #34465c;
  border-radius: 10px;
  padding: 20px;
  background: #0e192b;
  max-width: 760px;
}
.quiz-progress {
  color: var(--muted);
  font-size: 0.8rem;
  margin: 0 0 8px;
}
.quiz-card h3 {
  font-size: 1.1rem;
  line-height: 1.45;
  margin: 0 0 14px;
}
.quiz-card .code-block {
  margin-bottom: 14px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.quiz-options {
  display: grid;
  gap: 8px;
}
.quiz-option {
  text-align: left;
  border: 1px solid #3a4d68;
  border-radius: 8px;
  padding: 12px 14px;
  background: #0b1526;
  color: var(--text);
  font: inherit;
  font-size: 0.92rem;
  line-height: 1.4;
  cursor: pointer;
}
.quiz-option:hover:not(:disabled) {
  border-color: var(--mint);
}
.quiz-option:focus-visible {
  outline: 3px solid var(--mint);
  outline-offset: 2px;
}
.quiz-option:disabled {
  cursor: default;
  opacity: 0.75;
}
.quiz-option[data-result="right"] {
  border-color: #53e3bd;
  background: #0f2a26;
  opacity: 1;
}
.quiz-option[data-result="wrong"] {
  border-color: #e06c75;
  background: #2a1219;
  opacity: 1;
}
.quiz-feedback {
  margin-top: 14px;
  border-left: 4px solid #8fa2bc;
  padding: 4px 0 4px 14px;
  line-height: 1.55;
  font-size: 0.92rem;
}
.quiz-feedback[data-result="right"] {
  border-color: #53e3bd;
}
.quiz-feedback[data-result="wrong"] {
  border-color: #e06c75;
}
.quiz-feedback p {
  margin: 0 0 6px;
}
.quiz-verdict-line {
  font-weight: 600;
}
#quiz-next,
#quiz-again {
  margin-top: 16px;
}
.quiz-done h3 {
  margin: 0 0 8px;
  font-size: 1.3rem;
}

/* Reference additions */
.ref-order {
  margin: 0;
  padding-left: 20px;
  line-height: 1.6;
}
.ref-order span {
  color: var(--muted);
}
.status-table {
  border-collapse: collapse;
  width: 100%;
  font-size: 0.85rem;
}
.status-table th,
.status-table td {
  text-align: left;
  vertical-align: top;
  padding: 6px 10px 6px 0;
  border-bottom: 1px solid #22314a;
}
.status-table th {
  white-space: nowrap;
  font-weight: 500;
}
.ref-badge {
  margin-left: auto;
  color: #c9b98f;
  font-size: 0.7rem;
  border: 1px solid #c9b98f55;
  border-radius: 4px;
  padding: 2px 6px;
}
.source-list-plain {
  margin: 0;
  padding-left: 20px;
  line-height: 1.8;
}
.source-list-plain a {
  color: var(--mint);
  text-decoration: underline;
  text-underline-offset: 3px;
}

@media (max-width: 560px) {
  .layer-facts {
    grid-template-columns: minmax(0, 1fr);
  }
  .layer-facts dd {
    margin-bottom: 6px;
  }
  .status-table th {
    white-space: normal;
  }
}

/* Announced to screen readers only; results are already on screen. */
.cache-main #status {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  padding: 0;
  border: 0;
}
