/* DevOps CTF: one strong green on a calm white page. */
:root {
  --brand: oklch(0.536 0.152 150.7); /* #00853a: #038e43 nudged darker so white text passes AA */
  --brand-deep: oklch(0.42 0.12 150.7);
  --on-brand: oklch(1 0 0);
  --on-brand-2: oklch(1 0 0);
  --bg: oklch(1 0 0);
  --ink: oklch(0.17 0 0);
  --ink-2: oklch(0.43 0 0);
  --rule: oklch(0.9 0 0);
  --wash: oklch(0.97 0.015 150.7);

  --font: "Archivo", ui-sans-serif, system-ui, sans-serif;
  --gutter: clamp(1rem, 4vw, 3rem);
  --measure: 66ch;
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
}

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 1.0625rem;
  line-height: 1.6;
  font-variant-numeric: tabular-nums;
}

::selection {
  background: var(--brand);
  color: var(--on-brand);
}

h1,
h2,
h3 {
  margin: 0;
  font-stretch: 75%;
  font-weight: 800;
  line-height: 0.98;
  letter-spacing: -0.02em;
  text-wrap: balance;
}

p {
  margin: 0;
  text-wrap: pretty;
}

a {
  color: inherit;
  text-underline-offset: 0.18em;
  text-decoration-thickness: 1px;
}

a:hover {
  text-decoration-thickness: 2px;
}

:focus-visible {
  outline: 3px solid currentColor;
  outline-offset: 3px;
  border-radius: 2px;
}

code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.9em;
  padding: 0.1em 0.35em;
  border-radius: 4px;
  background: var(--wash);
}

.wrap {
  width: 100%;
  max-width: 72rem;
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.skip {
  position: absolute;
  left: var(--gutter);
  top: -3rem;
  padding: 0.5rem 0.75rem;
  background: var(--ink);
  color: var(--bg);
  z-index: 10;
}

.skip:focus {
  top: 0.75rem;
}

/* Header */
.site-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  padding-block: 1.25rem;
}

.wordmark {
  font-stretch: 75%;
  font-weight: 800;
  font-size: 1.35rem;
  letter-spacing: -0.01em;
  text-decoration: none;
}

.site-header nav {
  display: flex;
  gap: clamp(1rem, 3vw, 2rem);
  font-size: 0.95rem;
}

.site-header nav a {
  text-decoration: none;
}

.site-header nav a:hover {
  text-decoration: underline;
}

/* Hero: the one place the brand colour is allowed to be loud. */
.hero {
  background: var(--brand);
  color: var(--on-brand);
  padding-bottom: clamp(2.5rem, 6vw, 4.5rem);
}

.hero h1 {
  margin-top: clamp(3rem, 10vw, 7rem);
  font-size: clamp(2.75rem, 1.1rem + 7vw, 6rem);
  max-width: none;
}

.hero h1 .line {
  display: block;
}

.hero .lede {
  margin-top: 1.75rem;
  max-width: 58ch;
  font-size: clamp(1.0625rem, 1rem + 0.4vw, 1.25rem);
  color: var(--on-brand-2);
}

.facts {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 2rem;
  margin: 2rem 0 0;
  padding: 0;
  list-style: none;
  font-weight: 600;
}

.button {
  display: inline-block;
  margin-top: 2.25rem;
  padding: 0.8rem 1.35rem;
  border-radius: 6px;
  background: var(--on-brand);
  color: var(--brand-deep);
  font-weight: 700;
  text-decoration: none;
  transition: background-color 160ms var(--ease-out), transform 160ms var(--ease-out);
}

.button:hover {
  background: var(--on-brand-2);
}

.button:active {
  transform: translateY(1px);
}

.button.solid {
  background: var(--brand);
  color: var(--on-brand);
}

.button.solid:hover {
  background: var(--brand-deep);
}

/* Health check: six services, most of them unhappy. */
.health {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 1.5rem 1rem;
  margin: clamp(3rem, 8vw, 5rem) 0 0;
  padding: 1.75rem 0 0;
  border-top: 1px solid oklch(1 0 0 / 0.35);
  list-style: none;
}

.health li {
  position: relative;
  padding-top: 1.75rem;
  font-size: 0.875rem;
  line-height: 1.35;
}

.health .node {
  position: absolute;
  top: 0;
  left: 0;
  display: grid;
  place-items: center;
  width: 1.05rem;
  height: 1.05rem;
  border-radius: 50%;
  background: var(--on-brand);
  animation: health-node 360ms var(--ease-out) backwards;
  animation-delay: calc(var(--i) * 110ms + 150ms);
}

.health .is-failed .node {
  background: transparent;
  border: 2px solid var(--on-brand);
  animation: health-node 360ms var(--ease-out) backwards, health-fail 900ms ease-out 1;
  animation-delay: calc(var(--i) * 110ms + 150ms), calc(var(--i) * 110ms + 700ms);
}

.health .is-failed .node svg {
  width: 0.55rem;
  height: 0.55rem;
}

.health .stage {
  display: block;
  font-weight: 700;
}

.health .status {
  color: var(--on-brand-2);
}

@keyframes health-node {
  from { opacity: 0; transform: scale(0.4); }
}

@keyframes health-fail {
  0%, 100% { box-shadow: 0 0 0 0 oklch(1 0 0 / 0); }
  30% { box-shadow: 0 0 0 0.45rem oklch(1 0 0 / 0.35); }
}

/* Sections */
.section {
  padding-block: clamp(3.5rem, 9vw, 6.5rem);
}

.section + .section {
  border-top: 1px solid var(--rule);
}

.section h2 {
  font-size: clamp(2rem, 1.2rem + 3vw, 3.25rem);
  max-width: 20ch;
}

.section .intro {
  margin-top: 1.25rem;
  max-width: var(--measure);
  color: var(--ink-2);
  font-size: 1.125rem;
}

/* What you'll be fixing: three areas, each with its own items. */
.areas {
  margin-top: clamp(2rem, 5vw, 3rem);
}

.area {
  display: grid;
  grid-template-columns: minmax(14rem, 22rem) minmax(0, 1fr);
  gap: 1.25rem clamp(2rem, 5vw, 4rem);
  padding-block: clamp(1.75rem, 4vw, 2.5rem);
  border-top: 1px solid var(--rule);
}

.area h3 {
  font-size: clamp(1.5rem, 1.2rem + 1vw, 2rem);
  line-height: 1.1;
}

.area .summary {
  margin-top: 0.6rem;
  color: var(--ink-2);
  max-width: 32ch;
}

.area dl {
  margin: 0;
  display: grid;
  grid-template-columns: minmax(8rem, 11rem) minmax(0, 1fr);
}

.area dt,
.area dd {
  margin: 0;
  padding-block: 0.8rem;
  border-top: 1px solid var(--rule);
}

.area dt:first-of-type,
.area dd:first-of-type {
  border-top: 0;
  padding-top: 0.2rem;
}

.area dt {
  font-weight: 700;
  padding-right: 1rem;
}

.area dd {
  color: var(--ink-2);
  max-width: 52ch;
}

/* Schedule */
.timeline {
  display: flex;
  gap: 3px;
  height: 3.25rem;
  margin: clamp(2rem, 5vw, 3rem) 0 0;
  padding: 0;
  list-style: none;
}

.timeline li {
  flex: var(--min) 1 0;
  min-width: 0;
  border-radius: 3px;
  background: oklch(0.86 0 0);
}

.timeline .play {
  display: flex;
  align-items: center;
  padding-inline: 1rem;
  background: var(--brand);
  color: var(--on-brand);
  font-weight: 700;
  font-size: 0.95rem;
  white-space: nowrap;
  overflow: hidden;
}

.timeline .freeze {
  background: var(--ink);
}

.agenda {
  margin: 1.5rem 0 0;
  padding: 0;
  list-style: none;
  max-width: 44rem;
}

.agenda li {
  display: grid;
  grid-template-columns: 7.5rem 6.5rem minmax(0, 1fr);
  gap: 0 1rem;
  padding-block: 0.7rem;
  border-top: 1px solid var(--rule);
}

.agenda time {
  color: var(--ink-2);
}

.agenda b {
  font-weight: 700;
}

.agenda span {
  color: var(--ink-2);
}

/* How to get in: a real sequence, so it gets real numbers. */
.steps {
  margin: clamp(2rem, 5vw, 3rem) 0 0;
  padding: 0;
  list-style: none;
  counter-reset: step;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr));
  gap: 2.5rem clamp(1.5rem, 4vw, 3rem);
}

.steps li {
  counter-increment: step;
}

.steps li::before {
  content: counter(step);
  display: block;
  font-stretch: 75%;
  font-weight: 800;
  font-size: 3.5rem;
  line-height: 1;
  color: var(--brand);
}

.steps h3 {
  margin-top: 0.75rem;
  font-size: 1.5rem;
}

.steps p {
  margin-top: 0.6rem;
  color: var(--ink-2);
}

.steps .button {
  margin-top: 1.25rem;
}

/* Footer */
.site-footer {
  padding-block: 2rem 3rem;
  border-top: 1px solid var(--rule);
  color: var(--ink-2);
  font-size: 0.95rem;
}

.site-footer .wrap {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.75rem 2rem;
}

/* Hint page */
.plain-header {
  border-bottom: 1px solid var(--rule);
}

.plain-header .wordmark {
  color: var(--brand);
}

.hints-page {
  padding-block: clamp(3rem, 9vw, 6rem);
}

.hints-page h1 {
  font-size: clamp(2.75rem, 1.5rem + 5vw, 5rem);
}

.hints-page .intro {
  margin-top: 1.25rem;
  max-width: 54ch;
  color: var(--ink-2);
  font-size: 1.125rem;
}

.hints {
  margin-top: clamp(2rem, 5vw, 3rem);
  max-width: 46rem;
  border-bottom: 1px solid var(--rule);
}

.hints details {
  border-top: 1px solid var(--rule);
}

.hints summary {
  display: grid;
  grid-template-columns: 4.5rem minmax(0, 1fr) auto;
  align-items: baseline;
  gap: 1rem;
  padding-block: 1.25rem;
  cursor: pointer;
  list-style: none;
}

.hints summary::-webkit-details-marker {
  display: none;
}

.hints summary .n {
  color: var(--brand);
  font-weight: 700;
}

.hints summary .title {
  font-stretch: 75%;
  font-weight: 750;
  font-size: 1.4rem;
  line-height: 1.2;
}

.hints summary::after {
  content: "Show";
  color: var(--ink-2);
  font-size: 0.9rem;
}

.hints details[open] summary::after {
  content: "Hide";
}

.hints summary:hover .title {
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
}

.hints .body {
  padding: 0 0 1.5rem 5.5rem;
  max-width: var(--measure);
}

.hints .body p + p,
.hints .body p + pre {
  margin-top: 0.75rem;
}

.hints pre {
  margin: 0.75rem 0 0;
  padding: 0.85rem 1rem;
  border-radius: 6px;
  background: var(--wash);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-size: 0.9rem;
}

.hints pre code {
  padding: 0;
  background: none;
}

.back {
  display: inline-block;
  margin-top: 2.5rem;
}

/* Small screens */
@media (max-width: 40rem) {
  .site-header nav .optional {
    display: none;
  }

  .area,
  .area dl {
    grid-template-columns: minmax(0, 1fr);
  }

  .area dt {
    padding-bottom: 0.15rem;
  }

  .area dd {
    border-top: 0;
    padding-top: 0;
  }

  .area dt:first-of-type,
  .area dd:first-of-type {
    padding-top: 0;
  }

  .agenda li {
    grid-template-columns: 5.75rem minmax(0, 1fr);
    font-size: 0.95rem;
  }

  .agenda span {
    grid-column: 2;
  }

  .timeline .play {
    font-size: 0.8rem;
    padding-inline: 0.6rem;
  }

  .health {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .hints summary {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .hints summary .n {
    grid-column: 1 / -1;
    margin-bottom: -0.75rem;
  }

  .hints .body {
    padding-left: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
}
