/*
 * My Address IP - Stylesheet
 *
 * Mobile-first, no framework, no external fonts. The IP address is the single
 * dominant element on the page; everything else is deliberately quiet.
 */

:root {
  --bg: #ffffff;
  --bg-alt: #f6f8fb;
  --surface: #ffffff;
  --border: #e2e8f0;
  --border-strong: #cbd5e1;
  --text: #0f172a;
  --text-soft: #475569;
  --text-muted: #5b6878;
  --accent: #1d4ed8;
  --accent-hover: #1e40af;
  --accent-soft: #eff6ff;
  --success: #047857;
  --danger: #b91c1c;
  --focus: #2563eb;

  --radius: 12px;
  --radius-sm: 8px;
  --wrap: 68rem;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b1220;
    --bg-alt: #111a2c;
    --surface: #131d31;
    --border: #243349;
    --border-strong: #32455f;
    --text: #e8eef7;
    --text-soft: #a6b5cb;
    --text-muted: #96a7be;
    --accent: #7aa2ff;
    --accent-hover: #9cbaff;
    --accent-soft: #17233c;
    --success: #4ade80;
    --danger: #fca5a5;
    --focus: #7aa2ff;
  }
}

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

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 1rem;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

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

/* --- Accessibility ------------------------------------------------------ */

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 100;
  background: var(--accent);
  color: #fff;
  padding: 0.7rem 1.1rem;
  border-radius: 0 0 var(--radius-sm) 0;
  font-weight: 600;
}
.skip-link:focus { left: 0; }

:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
  border-radius: 4px;
}

/* --- Header ------------------------------------------------------------- */

.site-header {
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  position: sticky;
  top: 0;
  z-index: 20;
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: 3.75rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  color: var(--text);
  text-decoration: none;
  font-weight: 700;
  letter-spacing: -0.01em;
}
.brand-mark { display: inline-flex; color: var(--accent); }
.brand-name { font-size: 1.02rem; }

.site-nav { display: flex; gap: 0.35rem; }
.site-nav a {
  color: var(--text-soft);
  text-decoration: none;
  font-size: 0.95rem;
  font-weight: 500;
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius-sm);
  min-height: 2.75rem;
  display: inline-flex;
  align-items: center;
}
.site-nav a:hover { color: var(--text); background: var(--bg-alt); }
.site-nav a[aria-current="page"] {
  color: var(--accent);
  background: var(--accent-soft);
  font-weight: 600;
}

/* --- Hero: the IP address is the page ----------------------------------- */

.hero {
  background: var(--bg-alt);
  border-bottom: 1px solid var(--border);
  padding: 2.25rem 0 2.5rem;
  text-align: center;
}

.hero h1 {
  margin: 0 0 1.5rem;
  font-size: clamp(1.5rem, 5vw, 2.1rem);
  line-height: 1.25;
  letter-spacing: -0.02em;
}

.hero-label {
  margin: 0 0 0.5rem;
  color: var(--text-soft);
  font-size: 0.98rem;
}

.ip-display {
  margin: 0 auto 1.25rem;
  max-width: 100%;
  font-family: var(--mono);
  font-size: clamp(1.6rem, 8.5vw, 3.25rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.15;
  color: var(--text);
  /* IPv6 addresses are long: wrap rather than overflow on narrow screens. */
  overflow-wrap: anywhere;
  word-break: break-word;
}

.ip-display.ip-error {
  font-size: clamp(1.15rem, 5vw, 1.6rem);
  color: var(--danger);
}

.hero-actions {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.6rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-height: 2.9rem;
  padding: 0.65rem 1.4rem;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: var(--accent);
  color: #fff;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.15s ease;
}
.btn:hover { background: var(--accent-hover); }
.btn:active { transform: translateY(1px); }

@media (prefers-color-scheme: dark) {
  .btn { color: #0b1220; }
}

.btn-icon { flex: none; }

.copy-status {
  margin: 0;
  min-height: 1.4rem;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--success);
}
.copy-status.is-error { color: var(--danger); }

.hero-meta {
  margin: 1.25rem auto 0;
  max-width: 34rem;
  color: var(--text-soft);
  font-size: 0.92rem;
}
.hero-meta.error-note { color: var(--danger); }

/* --- Sections and cards -------------------------------------------------- */

.section { padding: 2.5rem 1rem; }

.card-heading {
  margin: 0 0 1.25rem;
  font-size: 1.25rem;
  letter-spacing: -0.01em;
}

.cards {
  display: grid;
  gap: 1rem;
  grid-template-columns: 1fr;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.15rem 1.25rem 1.25rem;
}

.card-title {
  margin: 0 0 0.75rem;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}

.info-list { margin: 0; }

.info-row {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem 1rem;
  padding: 0.6rem 0;
  border-bottom: 1px solid var(--border);
}
.info-row:last-child { border-bottom: 0; padding-bottom: 0; }

.info-row dt {
  color: var(--text-soft);
  font-size: 0.9rem;
}

.info-row dd {
  margin: 0;
  font-weight: 600;
  text-align: right;
  overflow-wrap: anywhere;
}

.mono { font-family: var(--mono); }

.muted {
  color: var(--text-muted);
  font-weight: 500;
  font-style: italic;
}

.card-note {
  display: flex;
  gap: 0.5rem;
  margin: 0.9rem 0 0;
  padding-top: 0.85rem;
  border-top: 1px solid var(--border);
  color: var(--text-soft);
  font-size: 0.82rem;
  line-height: 1.55;
}
.card-note svg { flex: none; margin-top: 0.22rem; }

/* --- Long-form content --------------------------------------------------- */

.content { max-width: 46rem; }

.content h2 {
  margin: 2.5rem 0 0.75rem;
  font-size: clamp(1.2rem, 3.6vw, 1.45rem);
  line-height: 1.3;
  letter-spacing: -0.01em;
  scroll-margin-top: 4.5rem;
}
.content > h2:first-child { margin-top: 0; }

.content p { margin: 0 0 1rem; color: var(--text-soft); }
.content ul { margin: 0 0 1rem; padding-left: 1.3rem; color: var(--text-soft); }
.content li { margin-bottom: 0.45rem; }
.content strong { color: var(--text); font-weight: 650; }

.content code {
  font-family: var(--mono);
  font-size: 0.88em;
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 0.1em 0.38em;
  overflow-wrap: anywhere;
}

a { color: var(--accent); text-underline-offset: 2px; }
a:hover { color: var(--accent-hover); }

/* --- FAQ ----------------------------------------------------------------- */

.faq { max-width: 46rem; }
.faq h2 { margin: 0 0 1.25rem; font-size: clamp(1.2rem, 3.6vw, 1.45rem); }

.faq-list { display: grid; gap: 0.6rem; }

.faq-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.faq-item summary {
  list-style: none;
  cursor: pointer;
  padding: 0.85rem 2.6rem 0.85rem 1rem;
  font-weight: 600;
  position: relative;
  border-radius: var(--radius-sm);
}
.faq-item summary::-webkit-details-marker { display: none; }

/* Chevron drawn in CSS: no icon font, no extra request. */
.faq-item summary::after {
  content: "";
  position: absolute;
  right: 1.1rem;
  top: 50%;
  width: 0.5rem;
  height: 0.5rem;
  margin-top: -0.35rem;
  border-right: 2px solid var(--text-muted);
  border-bottom: 2px solid var(--text-muted);
  transform: rotate(45deg);
  transition: transform 0.15s ease;
}
.faq-item[open] summary::after { transform: rotate(-135deg); margin-top: -0.15rem; }

.faq-item summary:hover { background: var(--bg-alt); }

.faq-answer { padding: 0 1rem 0.95rem; }
.faq-answer p { margin: 0; color: var(--text-soft); }

/* --- Legal / text pages -------------------------------------------------- */

.page-title {
  margin: 0 0 0.4rem;
  font-size: clamp(1.5rem, 5vw, 2rem);
  letter-spacing: -0.02em;
}
.page-updated {
  margin: 0 0 2rem;
  color: var(--text-muted);
  font-size: 0.88rem;
}

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

.site-footer {
  margin-top: 1rem;
  border-top: 1px solid var(--border);
  background: var(--bg-alt);
  padding: 2rem 0;
}

.footer-inner { text-align: center; }

.footer-brand {
  margin: 0 0 0.75rem;
  font-weight: 700;
}

.footer-nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.25rem 0.5rem;
  margin-bottom: 0.9rem;
}
.footer-nav a {
  color: var(--text-soft);
  text-decoration: none;
  font-size: 0.92rem;
  padding: 0.5rem 0.6rem;
  min-height: 2.75rem;
  display: inline-flex;
  align-items: center;
  border-radius: var(--radius-sm);
}
.footer-nav a:hover { color: var(--accent); text-decoration: underline; }

.footer-note {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.82rem;
  max-width: 38rem;
  margin-inline: auto;
}

/* --- Wider screens -------------------------------------------------------- */

@media (min-width: 40rem) {
  .hero { padding: 3.5rem 0 3.75rem; }
  .hero-actions { flex-direction: row; justify-content: center; gap: 1rem; }
  .copy-status { min-height: 0; }
  .section { padding: 3.25rem 1rem; }
}

@media (min-width: 60rem) {
  .cards { grid-template-columns: repeat(3, 1fr); }
  body { font-size: 1.03rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
