/* IP to AWS Service: site-wide styles (layout, typography, shared components).
   Tool and live-widget styles live in tool.css; this file never depends on it.

   Design tokens (use these in tool.css too):
   --bg --bg-soft --bg-sunken       page, raised surface, code/sunken surface
   --text --text-muted              body text, secondary text (AA on all surfaces)
   --border --border-strong         hairlines, form-control borders (3:1)
   --accent --accent-hover          links, primary buttons, focus ring
   --accent-soft --accent-contrast  tinted background, text on --accent
   --ok-* --warn-* --special-* --neutral-*   badge text/bg/border
   --info-bg --info-line --warn-bg-callout --warn-line   callouts
   --radius --radius-small --shadow --font --mono --measure --page --gutter */

:root {
  color-scheme: light dark;
  accent-color: var(--accent);
  --bg: #fff;
  --bg-soft: #f5f7f9;
  --bg-sunken: #eef1f4;
  --text: #16202a;
  --text-muted: #4e5a66;
  --border: #d5dce3;
  --border-strong: #7a8794;
  --accent: #0a5ea8;
  --accent-hover: #084b87;
  --accent-soft: #e8f1fa;
  --accent-contrast: #fff;
  --ok-text: #0b5a3b; --ok-bg: #e4f4ec; --ok-border: #a3d6be;
  --warn-text: #7a4800; --warn-bg: #fdf3e1; --warn-border: #e9c37e;
  --special-text: #4a2ea0; --special-bg: #f0ebfd; --special-border: #cbbef2;
  --neutral-text: #3d4852; --neutral-bg: #eef1f4; --neutral-border: #d5dce3;
  --info-bg: #eef5fc; --info-line: #0a5ea8;
  --warn-bg-callout: #fdf6e8; --warn-line: #b06a00;
  --shadow: 0 1px 2px rgb(16 24 32 / 6%), 0 4px 12px rgb(16 24 32 / 6%);
  --radius: 8px;
  --radius-small: 6px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", "Liberation Sans", sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  --measure: 46rem;
  --page: 72rem;
  --gutter: 1rem;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e1318;
    --bg-soft: #151c23;
    --bg-sunken: #1b232c;
    --text: #e4e9ee;
    --text-muted: #9ba8b5;
    --border: #2b3540;
    --border-strong: #6b7886;
    --accent: #6cb4f5;
    --accent-hover: #9accf8;
    --accent-soft: #142231;
    --accent-contrast: #07121d;
    --ok-text: #7fd6ad; --ok-bg: #0f2a20; --ok-border: #1f5a41;
    --warn-text: #f0c46e; --warn-bg: #30230b; --warn-border: #6a4d14;
    --special-text: #c4b5ff; --special-bg: #241c42; --special-border: #4a3a8a;
    --neutral-text: #c5ced7; --neutral-bg: #1b232c; --neutral-border: #2b3540;
    --info-bg: #10202f; --info-line: #4a9be0;
    --warn-bg-callout: #241d0e; --warn-line: #c98a1a;
    --shadow: 0 1px 2px rgb(0 0 0 / 30%), 0 4px 12px rgb(0 0 0 / 25%);
  }
}

@media (min-width: 48rem) {
  :root { --gutter: 1.5rem; }
}

/* ---------- base ---------- */

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

/* The hidden attribute always wins over component display rules. */
[hidden] { display: none !important; }

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

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--text);
  font: 400 1rem/1.6 var(--font);
  overflow-wrap: break-word;
}

main { flex: 1 0 auto; }

h1, h2, h3, h4 { margin: 0 0 .5em; line-height: 1.25; font-weight: 650; letter-spacing: -.01em; text-wrap: balance; }
h1 { font-size: clamp(1.75rem, 1.4rem + 1.6vw, 2.35rem); letter-spacing: -.02em; }
h2 { font-size: clamp(1.35rem, 1.22rem + .6vw, 1.6rem); }
h3 { font-size: 1.15rem; }
h4 { font-size: 1rem; }

p, ul, ol, dl, blockquote, pre, table, figure, details { margin: 0 0 1rem; }

a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: .18em; }
a:hover { color: var(--accent-hover); text-decoration-thickness: 2px; }

:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
[id] { scroll-margin-top: 1rem; }

img, video { max-width: 100%; height: auto; }
svg { max-width: 100%; }

hr { border: 0; border-top: 1px solid var(--border); margin: 2rem 0; }

strong, b { font-weight: 650; }

code, kbd, samp, pre { font-family: var(--mono); font-size: .875em; }

:not(pre) > code {
  padding: .1em .35em;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--bg-sunken);
  overflow-wrap: anywhere;
}
a > code { color: inherit; }

pre {
  padding: .85rem 1rem;
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-sunken);
  line-height: 1.5;
  tab-size: 2;
}
pre code { font-size: inherit; }

table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
caption { padding: 0 0 .5rem; text-align: left; font-weight: 600; }
th, td { padding: .5rem .75rem; border-bottom: 1px solid var(--border); text-align: left; vertical-align: top; }
thead th { border-bottom-width: 2px; background: var(--bg-soft); font-size: .875rem; font-weight: 600; }

details > summary { cursor: pointer; font-weight: 600; }
details[open] > summary { margin-bottom: .5rem; }

input, select, textarea, button { font: inherit; color: inherit; }
input:not([type="checkbox"], [type="radio"], [type="range"], [type="color"]), select, textarea {
  max-width: 100%;
  min-height: 2.75rem;
  padding: .5rem .7rem;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-small);
  background: var(--bg);
  color: var(--text);
}
textarea { width: 100%; min-height: 8rem; font-family: var(--mono); line-height: 1.5; resize: vertical; }
@media (min-width: 48rem) { textarea { font-size: .875rem; } }
::placeholder { color: var(--text-muted); opacity: 1; }
:disabled { cursor: not-allowed; }

/* ---------- layout ---------- */

.container { width: 100%; max-width: var(--page); margin-inline: auto; padding-inline: var(--gutter); }
.container .container { max-width: none; padding-inline: 0; }

.skip-link {
  position: absolute;
  top: .5rem;
  left: .5rem;
  z-index: 100;
  padding: .6rem 1rem;
  border-radius: var(--radius-small);
  background: var(--accent);
  color: var(--accent-contrast);
  font-weight: 600;
  transform: translateY(-150%);
}
.skip-link:focus { transform: none; color: var(--accent-contrast); outline-color: var(--text); }

.site-header { border-bottom: 1px solid var(--border); background: var(--bg); }
.site-header-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0 1.5rem;
  padding-block: .35rem;
}
.site-name {
  display: inline-flex;
  align-items: center;
  gap: .55rem;
  min-height: 2.75rem;
  color: var(--text);
  font-weight: 700;
  font-size: 1.0625rem;
  letter-spacing: -.01em;
  text-decoration: none;
}
.site-name:hover { color: var(--text); }
.site-logo { flex: none; color: var(--accent); }
.site-logo-glyph { stroke: var(--bg); }
.site-logo-dots { fill: var(--bg); }

.site-nav ul { display: flex; flex-wrap: wrap; margin: 0 0 0 -.5rem; padding: 0; list-style: none; }
.site-nav a {
  display: block;
  padding: .6rem .5rem;
  border-radius: var(--radius-small);
  color: var(--text-muted);
  font-size: .9375rem;
  font-weight: 500;
  text-decoration: none;
}
.site-nav a:hover { background: var(--bg-soft); color: var(--text); }
.site-nav a[aria-current] { color: var(--text); box-shadow: inset 0 -2px 0 var(--accent); border-radius: 0; }
@media (min-width: 40rem) {
  .site-nav ul { margin: 0; gap: .25rem; }
  .site-nav a { padding-inline: .7rem; }
}

.breadcrumbs { padding-top: 1rem; font-size: .875rem; }
.breadcrumbs ol { display: flex; flex-wrap: wrap; align-items: center; margin: 0; padding: 0; list-style: none; }
.breadcrumbs li { display: inline-flex; align-items: center; }
.breadcrumbs li + li::before {
  content: ""; width: .4em; height: .4em; margin: 0 .7em 0 .55em;
  border: solid var(--text-muted); border-width: 1.5px 1.5px 0 0; transform: rotate(45deg);
}
.breadcrumbs a { display: inline-block; padding-block: .2rem; color: var(--text-muted); }
.breadcrumbs a:hover { color: var(--accent-hover); }
.breadcrumbs [aria-current] { color: var(--text); }

.site-main { padding-block: 1.5rem 2.5rem; }
.breadcrumbs + .site-main { padding-top: .75rem; }
@media (min-width: 48rem) { .site-main { padding-block: 2.25rem 3.5rem; } }

.site-footer {
  padding-block: 1.5rem 2rem;
  border-top: 1px solid var(--border);
  background: var(--bg-soft);
  color: var(--text-muted);
  font-size: .875rem;
}
.site-footer p { margin: .35rem 0 0; max-width: var(--measure); }
.site-footer code { padding: 0; border: 0; background: none; }
.footer-nav ul { display: flex; flex-wrap: wrap; gap: 0 1.25rem; margin: 0 0 .5rem; padding: 0; list-style: none; }
.footer-nav a { display: inline-block; padding-block: .35rem; }

/* Touch screens: 44px targets for small links and summaries. */
@media (pointer: coarse) {
  .site-nav a { display: flex; align-items: center; min-height: 2.75rem; padding-block: 0; }
  .footer-nav a,
  .breadcrumbs a { display: inline-flex; align-items: center; min-height: 2.75rem; padding-block: 0; }
  details > summary { padding-block: .6rem; }
}

/* ---------- text ---------- */

.prose { max-width: var(--measure); }
.prose > :first-child { margin-top: 0; }
.prose :where(h2) { margin-top: 2.25rem; }
.prose :where(h3) { margin-top: 1.75rem; }
.prose :where(h2 + h3) { margin-top: 1rem; }
.prose :where(ul, ol) { padding-left: 1.4rem; }
.prose :where(li + li) { margin-top: .35rem; }
.prose :where(li > ul, li > ol) { margin: .35rem 0 0; }
.prose :where(li > p) { margin-bottom: .5rem; }
.prose :where(dt) { font-weight: 650; }
.prose :where(dd) { margin: 0 0 .75rem 1.25rem; }
.prose :where(blockquote) {
  padding: .25rem 0 .25rem 1rem;
  border-left: 3px solid var(--border-strong);
  color: var(--text-muted);
}
.prose :where(blockquote > :last-child) { margin-bottom: 0; }
.prose :where(figcaption) { color: var(--text-muted); font-size: .875rem; }

.lead { font-size: 1.125rem; line-height: 1.55; color: var(--text); }
@media (min-width: 48rem) { .lead { font-size: 1.1875rem; } }
.muted { color: var(--text-muted); }
.small { font-size: .875rem; }

.stack > * { margin-block: 0; }
.stack > * + * { margin-block-start: var(--stack-space, 1rem); }
.stack > :is(h2, h3) + * { margin-block-start: .5rem; }
.stack > * + :is(h2, h3) { margin-block-start: 2rem; }

.grid-2 { display: grid; grid-template-columns: minmax(0, 1fr); gap: 1.5rem; margin-bottom: 1.5rem; }
@media (min-width: 48rem) { .grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 2rem; } }

.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; margin: -1px; padding: 0;
  overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; border: 0;
}

/* ---------- components ---------- */

.callout {
  margin: 0 0 1.25rem;
  padding: .85rem 1rem;
  border: 1px solid var(--border);
  border-left-width: 4px;
  border-radius: var(--radius);
  background: var(--bg-soft);
}
.callout > :last-child { margin-bottom: 0; }
.callout-info { border-color: var(--info-bg); border-left-color: var(--info-line); background: var(--info-bg); }
.callout-warn { border-color: var(--warn-bg-callout); border-left-color: var(--warn-line); background: var(--warn-bg-callout); }

.card {
  display: block;
  padding: 1rem 1.1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  color: inherit;
}
.card > :last-child { margin-bottom: 0; }
.card :is(h2, h3) { margin: 0 0 .35rem; font-size: 1.0625rem; }
.card p { color: var(--text-muted); }
a.card { text-decoration: none; transition: border-color .15s, box-shadow .15s; }
a.card :is(h2, h3) { color: var(--accent); }
a.card:hover { border-color: var(--accent); box-shadow: var(--shadow); color: inherit; }
a.card:hover :is(h2, h3) { text-decoration: underline; text-underline-offset: .18em; }

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 16rem), 1fr));
  gap: 1rem;
  margin: 0 0 1.5rem;
  padding: 0;
  list-style: none;
}
.card-grid > li { display: flex; flex-direction: column; margin: 0; }
.card-grid > li > .card { flex: 1; }

.badge {
  display: inline-flex;
  align-items: center;
  gap: .3em;
  padding: .05em .6em;
  border: 1px solid var(--neutral-border);
  border-radius: 999px;
  background: var(--neutral-bg);
  color: var(--neutral-text);
  font-size: .8125rem;
  font-weight: 600;
  line-height: 1.6;
  white-space: nowrap;
  vertical-align: .1em;
}
.badge-aws { border-color: var(--ok-border); background: var(--ok-bg); color: var(--ok-text); }
.badge-notlisted { border-color: var(--warn-border); background: var(--warn-bg); color: var(--warn-text); }
.badge-special { border-color: var(--special-border); background: var(--special-bg); color: var(--special-text); }
.badge-neutral { border-color: var(--neutral-border); background: var(--neutral-bg); color: var(--neutral-text); }

.table-wrap { margin: 0 0 1.25rem; overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); }
/* Scrollable boxes are focusable (tabindex=0, added by the build) so keyboards can scroll them. */
.table-wrap:focus-visible, pre:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.table-wrap > table { margin: 0; }
.table-wrap tbody tr:last-child > * { border-bottom: 0; }
.table-wrap :not(pre) > code { white-space: nowrap; overflow-wrap: normal; }

kbd, .kbd {
  display: inline-block;
  padding: .05em .4em;
  border: 1px solid var(--border-strong);
  border-bottom-width: 2px;
  border-radius: 4px;
  background: var(--bg-soft);
  font-family: var(--mono);
  font-size: .8125em;
  line-height: 1.4;
  white-space: nowrap;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .4em;
  min-height: 2.75rem;
  padding: .5rem 1rem;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-small);
  background: var(--bg);
  color: var(--text);
  font-weight: 600;
  line-height: 1.2;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  transition: background-color .15s, border-color .15s;
}
.btn:hover { background: var(--bg-soft); border-color: var(--text-muted); color: var(--text); }
.btn:active { transform: translateY(1px); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .55; cursor: not-allowed; transform: none; }
.btn-primary { border-color: var(--accent); background: var(--accent); color: var(--accent-contrast); }
.btn-primary:hover { border-color: var(--accent-hover); background: var(--accent-hover); color: var(--accent-contrast); }
.btn-small { min-height: 2rem; padding: .25rem .7rem; font-size: .875rem; }
.btn-link {
  min-height: 0;
  padding: 0;
  border: 0;
  background: none;
  color: var(--accent);
  font-weight: inherit;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: .18em;
  cursor: pointer;
}
.btn-link:hover { background: none; color: var(--accent-hover); text-decoration-thickness: 2px; }

.lookup-form { display: flex; flex-wrap: wrap; gap: .5rem; max-width: 36rem; margin: 0 0 1.5rem; }
.lookup-form label { flex: 1 0 100%; font-weight: 600; }
.lookup-form input { flex: 1 1 8rem; min-width: 0; }
.lookup-form .btn { flex: none; }

.live { margin: 0 0 1.5rem; padding: 1rem; border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg-soft); }
/* Filled by live.js; without JavaScript there is nothing to show. */
.live:empty { display: none; }
.live > :last-child { margin-bottom: 0; }

/* ---------- preferences ---------- */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
    scroll-behavior: auto !important;
  }
}

@media (forced-colors: active) {
  .badge, .btn, .callout, .card, .live, .skip-link { border: 1px solid CanvasText; }
  .site-nav a[aria-current] { text-decoration: underline; }
}

@media print {
  :root {
    color-scheme: light;
    --bg: #fff; --bg-soft: #fff; --bg-sunken: #f4f4f4; --text: #000; --text-muted: #333;
    --border: #bbb; --accent: #000; --accent-hover: #000;
  }
  body { font-size: 11pt; }
  .skip-link, .site-nav, .footer-nav, .lookup-form, .btn, .breadcrumbs { display: none !important; }
  .site-header, .site-footer { border: 0; background: none; }
  .site-footer { border-top: 1px solid #bbb; }
  .prose a[href^="http"]::after { content: " (" attr(href) ")"; font-size: .85em; overflow-wrap: anywhere; }
  pre, blockquote, table, .callout, .card, figure { break-inside: avoid; }
  h2, h3 { break-after: avoid; }
  .table-wrap { overflow: visible; }
  a.card { box-shadow: none; }
}
