/* nginx.org home page. One file, no dependencies. */

/* ---------- Colors and fonts ---------- */

:root {
  --bg: #ffffff;
  --bg-soft: #f1f6f2;
  --text: #17231c;
  --muted: #55655b;
  --line: #d3dfd7;
  --green: #009639;        /* NGINX brand green */
  --link: #00752c;         /* darker green, readable on white */
  --alert: #96500a;

  /* Code panels are dark in both themes */
  --code-bg: #10201a;
  --code-text: #dfeae3;
  --code-muted: #93a99c;
  --code-line: #2a3d33;
  --code-accent: #4fd683;

  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1713;
    --bg-soft: #16211b;
    --text: #e6eee8;
    --muted: #9db0a4;
    --line: #2b3b32;
    --link: #4fd683;
    --alert: #f0b35a;
    --code-bg: #0a120e;
  }
}

/* ---------- Base ---------- */

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 1rem/1.6 var(--sans);
}

a {
  color: var(--link);
  text-underline-offset: 0.15em;
}

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

:focus-visible {
  outline: 2px solid var(--link);
  outline-offset: 2px;
}

h1,
h2,
h3 {
  margin: 0 0 0.5em;
  line-height: 1.15;
  text-wrap: balance;
}

h1 {
  max-width: 48rem;
  font-size: clamp(2.25rem, 5vw, 3.5rem);
  letter-spacing: -0.025em;
}

h2 {
  font-size: clamp(1.6rem, 3vw, 2.1rem);
  letter-spacing: -0.015em;
}

h3 {
  font-size: 1.1rem;
}

p {
  margin: 0 0 1em;
}

code,
pre {
  font-family: var(--mono);
  font-size: 0.875em;
}

.wrap {
  max-width: 70rem;
  margin-inline: auto;
  padding-inline: 1.5rem;
}

.section {
  padding-block: 4rem;
}

.section-soft {
  background: var(--bg-soft);
}

.intro {
  max-width: 40rem;
  color: var(--muted);
  font-size: 1.1rem;
}

.small {
  color: var(--muted);
  font-size: 0.9rem;
}

.link-row a {
  margin-right: 1.25rem;
}

/* Two columns: wide one on the left, narrow one on the right */
.split {
  display: grid;
  grid-template-columns: minmax(0, 3fr) minmax(0, 2fr);
  gap: 3rem;
  align-items: start;
  margin-block: 1.5rem 2.5rem;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.skip-link {
  position: absolute;
  left: -999rem;
}

.skip-link:focus {
  left: 1rem;
  top: 1rem;
  padding: 0.5rem 1rem;
  background: var(--bg);
  z-index: 1;
}

/* ---------- Announcement and header ---------- */

.notice {
  background: var(--code-bg);
  color: var(--code-text);
  font-size: 0.9rem;
}

.notice p {
  margin-block: 0;
  padding-block: 0.6rem;
}

.notice a {
  margin-left: 0.75rem;
  color: var(--code-accent);
}

.site-header {
  border-bottom: 1px solid var(--line);
}

.site-header .wrap {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 2rem;
  padding-block: 1rem;
}

.brand {
  color: var(--green);
  font-size: 1.6rem;
  font-weight: 700;
  letter-spacing: -0.04em;
  line-height: 1;
  text-decoration: none;
}

.site-nav,
.site-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1.5rem;
}

.site-links {
  margin-left: auto;
}

.site-header a:not(.brand) {
  color: var(--text);
  text-decoration: none;
}

.site-header a:not(.brand):hover {
  text-decoration: underline;
}

/* ---------- Hero ---------- */

.lede {
  max-width: 36rem;
  font-size: 1.2rem;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}

.button {
  padding: 0.6rem 1.1rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  font-weight: 600;
  text-decoration: none;
}

.button:hover {
  border-color: var(--text);
}

/* ---------- Code panels: one-line install, and tabs ---------- */

.install,
.tabs {
  overflow: hidden;
  border-radius: 10px;
  background: var(--code-bg);
  color: var(--code-text);
}

.code-foot {
  margin: 0;
  padding: 0.75rem 1.25rem;
  border-top: 1px solid var(--code-line);
  color: var(--code-muted);
  font-size: 0.9rem;
}

.code-foot a {
  color: var(--code-accent);
}

.code-foot code {
  color: var(--code-text);
}

.comment {
  color: var(--code-muted);
}

.copy {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  padding: 0.3rem 0.7rem;
  border: 1px solid var(--code-line);
  border-radius: 6px;
  background: var(--code-bg);
  color: var(--code-text);
  font: inherit;
  font-size: 0.8rem;
  cursor: pointer;
}

.copy:hover {
  border-color: var(--code-accent);
}

/* One-line install: the main action of the page */

.install {
  margin-block: 2rem;
}

.install-title {
  margin: 0;
  padding: 0.75rem 1.25rem;
  border-bottom: 1px solid var(--code-line);
  color: var(--code-muted);
  font-size: 0.9rem;
  font-weight: 600;
  letter-spacing: 0;
}

.install-command {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1rem;
  padding: 1.5rem 1.25rem;
}

.install-command pre {
  flex: 1 1 16rem;
  margin: 0;
  font-size: clamp(0.9rem, 1.5vw, 1.15rem);
  line-height: 1.5;
  white-space: pre-wrap;      /* wrap on small screens instead of scrolling */
  overflow-wrap: anywhere;
}

/* The "$" is drawn by CSS, so it is never selected or copied */
.install-command code {
  font-size: inherit;
}

.install-command code::before {
  content: "$ ";
  color: var(--code-accent);
}

.install-command .copy {
  position: static;
  padding: 0.55rem 1.2rem;
  border-color: var(--code-accent);
  background: var(--code-accent);
  color: #0a120e;
  font-size: 0.95rem;
  font-weight: 600;
}

.install-command .copy:hover {
  background: #ffffff;
  border-color: #ffffff;
}

.install-command .copy:focus-visible {
  outline-color: #ffffff;
}

/* Tabs */

.tab-list {
  display: flex;
  flex-wrap: wrap;
  min-width: 0;
  margin: 0;
  padding: 0.5rem 0.5rem 0;
  border: 0;
  border-bottom: 1px solid var(--code-line);
}

/* The radio button stays in the page for keyboard use, but is not drawn */
.tab-list input {
  position: absolute;
  opacity: 0;
}

.tab-list span {
  display: block;
  padding: 0.5rem 0.85rem;
  border-bottom: 2px solid transparent;
  color: var(--code-muted);
  font-size: 0.9rem;
  cursor: pointer;
}

.tab-list span:hover {
  color: var(--code-text);
}

.tab-list input:checked + span {
  border-bottom-color: var(--code-accent);
  color: #ffffff;
}

.tab-list input:focus-visible + span {
  outline: 2px solid var(--code-accent);
  outline-offset: -2px;
}

.tab-panel {
  position: relative;
}

.tab-panel pre {
  margin: 0;
  padding: 1.25rem;
  overflow-x: auto;
  line-height: 1.6;
  tab-size: 4;
}

/* Same height for every config example, so the page does not jump */
.tabs-config pre {
  min-height: 23rem;
}

/* ---------- Term lists: commands and versions ---------- */

.terms {
  margin: 0 0 1em;
}

.terms dt {
  margin-top: 1rem;
  font-weight: 600;
}

.terms dd {
  margin: 0.15rem 0 0;
  color: var(--muted);
}

.terms code {
  padding: 0.15rem 0.45rem;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: var(--bg);
  font-weight: 400;
}

/* ---------- Features ---------- */

.features {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(17rem, 1fr));
  gap: 2rem 2.5rem;
  margin-block: 2.5rem 3rem;
}

.feature {
  padding-top: 1rem;
  border-top: 1px solid var(--line);
}

.feature p {
  margin-bottom: 0.5em;
  color: var(--muted);
}

.facts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(17rem, 1fr));
  gap: 0.75rem 2.5rem;
  margin: 0 0 1.5rem;
  padding: 0;
  list-style: none;
}

/* ---------- Download table ---------- */

.table-scroll {
  overflow-x: auto;
  margin-bottom: 1.5rem;
}

table {
  width: 100%;
  border-collapse: collapse;
  white-space: nowrap;
}

th,
td {
  padding: 0.8rem 2rem 0.8rem 0;
  border-bottom: 1px solid var(--line);
  text-align: left;
}

thead th {
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 600;
}

.pgp {
  margin-left: 0.5rem;
  font-size: 0.85rem;
}

/* ---------- News ---------- */

.news {
  margin: 1.5rem 0;
  padding: 0;
  list-style: none;
}

.news > li {
  display: grid;
  grid-template-columns: 7.5rem minmax(0, 1fr);
  gap: 1rem;
  padding-block: 1.1rem;
  border-top: 1px solid var(--line);
}

.news time {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.news p {
  margin-bottom: 0.4em;
}

.news summary {
  width: fit-content;
  color: var(--muted);
  cursor: pointer;
}

.news details ul {
  margin: 0.6rem 0;
  padding-left: 1.2rem;
}

.tag {
  margin-right: 0.4rem;
  padding: 0.1rem 0.5rem;
  border: 1px solid currentColor;
  border-radius: 5px;
  color: var(--alert);
  font-size: 0.8rem;
  font-weight: 600;
}

/* ---------- Other projects ---------- */

.projects {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(17rem, 1fr));
  gap: 2.5rem;
  margin-block: 2rem;
}

.project img {
  display: block;
  margin-bottom: 0.75rem;
}

.project p {
  color: var(--muted);
}

/* ---------- Footer ---------- */

.site-footer {
  padding-block: 3rem 2rem;
  border-top: 1px solid var(--line);
}

.footer-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr));
  gap: 2rem;
  margin-bottom: 2.5rem;
}

.footer-grid h2 {
  font-size: 0.95rem;
  letter-spacing: 0;
}

.footer-grid a {
  display: block;
  width: fit-content;
  padding-block: 0.2rem;
  color: var(--muted);
  text-decoration: none;
}

.footer-grid a:hover {
  color: var(--text);
  text-decoration: underline;
}

/* ---------- Small screens ---------- */

@media (max-width: 56rem) {
  .split {
    grid-template-columns: minmax(0, 1fr);
    gap: 2rem;
  }

  .section {
    padding-block: 3rem;
  }

  .tabs-config pre {
    min-height: 0;
  }
}

@media (max-width: 36rem) {
  .wrap {
    padding-inline: 1rem;
  }

  .site-links {
    margin-left: 0;
  }

  .news > li {
    grid-template-columns: minmax(0, 1fr);
    gap: 0.25rem;
  }
}
