/* ============================================================
 * ipme.sh design system, Apple-inspired remix.
 *
 * Page background is the parchment tone Apple uses on apple.com
 * (#f5f5f7), and every widget that holds content (IP cards, tables,
 * code blocks, collapsibles, the verdict box, the network-signals
 * card) is a dark tile on top of it. The single drop-shadow Apple
 * reserves for product photography is applied to those widgets here
 * because they ARE the page's "products" — the data the user came
 * for. Interactive elements get exactly one color: Action Blue
 * #0066cc on light surfaces, the brighter #2997ff on dark ones.
 * ============================================================ */

:root {
  /* ---- Colors ---- */
  --canvas:         #ffffff;
  --parchment:      #f5f5f7;   /* page background */
  --pearl:          #fafafc;
  --tile-1:         #272729;   /* primary widget background */
  --tile-2:         #2a2a2c;   /* secondary widget (primary IP card) */
  --tile-3:         #252527;   /* table header rows, nested blocks */
  --black:          #000000;   /* masthead only */

  --ink:            #1d1d1f;   /* body text on parchment */
  --ink-muted-80:   #333333;   /* secondary text on light */
  --ink-muted-48:   #7a7a7a;   /* fine print / disabled */
  --on-dark:        #ffffff;   /* text on dark widgets */
  --body-muted:     #cccccc;   /* secondary text on dark */

  --hairline:       #e0e0e0;
  --divider-soft:   #f0f0f0;

  --action:         #0066cc;   /* the single interactive color */
  --action-focus:   #0071e3;
  --action-on-dark: #2997ff;   /* sky variant for inside dark widgets */

  /* Status accents (used sparingly on .notes / .verdict / .badge) */
  --ok:             #30d158;
  --warn:           #ff9f0a;

  /* ---- Type ---- */
  --font-display: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --font-text:    -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --font-mono:    ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;

  /* ---- Shadow ----
   * Apple's one shadow, reserved for products. Here, the dark widgets
   * are the products. */
  --product-shadow: rgba(0, 0, 0, 0.22) 3px 5px 30px 0;

  /* ---- Misc ---- */
  --container-max: 980px;
}

/* ============================================================
 * Reset + globals
 * ============================================================ */

*,
*::before,
*::after {
  box-sizing: border-box;
  -webkit-tap-highlight-color: rgba(0, 102, 204, 0.18);
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--parchment);
  color: var(--ink);
  font-family: var(--font-text);
  font-size: 17px;
  font-weight: 400;
  line-height: 1.47;
  letter-spacing: -0.374px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.container {
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 0 24px;
}

@supports (padding: max(0px)) {
  .container {
    padding-left: max(24px, env(safe-area-inset-left));
    padding-right: max(24px, env(safe-area-inset-right));
  }
}

/* ============================================================
 * Masthead — Apple global-nav: 44px true-black bar
 * ============================================================ */

.masthead {
  background: var(--black);
  color: var(--on-dark);
  position: sticky;
  top: 0;
  z-index: 100;
}

.masthead .container {
  display: flex;
  align-items: center;
  height: 44px;
  gap: 24px;
  position: relative;
}

.brand {
  font-family: var(--font-text);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.13px;
  color: var(--on-dark);
  text-decoration: none;
  white-space: nowrap;
}

.masthead nav {
  margin-left: auto;
  display: flex;
  gap: 24px;
}

.masthead nav a {
  font-family: var(--font-text);
  font-size: 12px;
  font-weight: 400;
  line-height: 1;
  letter-spacing: -0.12px;
  color: var(--on-dark);
  text-decoration: none;
  opacity: 0.78;
  transition: opacity 0.15s ease;
  padding: 4px 0;
}

.masthead nav a:hover {
  opacity: 1;
}

.masthead nav a[aria-current="page"] {
  opacity: 1;
  font-weight: 600;
}

/* Hamburger toggle, mobile only */
.nav-toggle {
  display: none;
  background: none;
  border: 0;
  padding: 8px;
  margin-left: auto;
  cursor: pointer;
  color: var(--on-dark);
  border-radius: 4px;
}

.nav-toggle:focus-visible {
  outline: 2px solid var(--action-on-dark);
  outline-offset: 2px;
}

.nav-toggle-bar {
  display: block;
  width: 18px;
  height: 1.5px;
  background: currentColor;
  margin: 3px 0;
  border-radius: 1px;
  transition: transform 0.2s ease, opacity 0.2s ease;
}

body.nav-open .nav-toggle-bar:nth-child(1) {
  transform: translateY(4.5px) rotate(45deg);
}
body.nav-open .nav-toggle-bar:nth-child(2) {
  opacity: 0;
}
body.nav-open .nav-toggle-bar:nth-child(3) {
  transform: translateY(-4.5px) rotate(-45deg);
}

/* ============================================================
 * Hero
 * ============================================================ */

.hero {
  padding: 96px 0 64px;
  text-align: center;
}

.hero h1 {
  font-family: var(--font-display);
  font-size: clamp(34px, 5.2vw, 56px);
  font-weight: 600;
  line-height: 1.07;
  letter-spacing: -0.5px;
  margin: 0 0 16px;
  color: var(--ink);
}

.hero p {
  font-family: var(--font-display);
  font-size: clamp(20px, 2.4vw, 28px);
  font-weight: 400;
  line-height: 1.21;
  letter-spacing: 0.196px;
  color: var(--ink-muted-80);
  margin: 0 auto 32px;
  max-width: 720px;
}

/* ============================================================
 * Sections + headings
 * ============================================================ */

section {
  padding: 64px 0;
}

section.hero {
  padding: 96px 0 48px;
}

h2 {
  font-family: var(--font-display);
  font-size: clamp(28px, 3.2vw, 40px);
  font-weight: 600;
  line-height: 1.12;
  letter-spacing: -0.28px;
  margin: 0 0 24px;
  color: var(--ink);
}

p {
  font-family: var(--font-text);
  font-size: 17px;
  font-weight: 400;
  line-height: 1.47;
  letter-spacing: -0.374px;
  margin: 0 0 16px;
  color: var(--ink);
}

p.footnote {
  font-family: var(--font-text);
  font-size: 14px;
  line-height: 1.43;
  letter-spacing: -0.224px;
  color: var(--ink-muted-80);
}

main em {
  font-style: italic;
}

/* ============================================================
 * IP cards (dark widgets)
 * ============================================================ */

.ip-grid {
  display: grid;
  /* Adapts to whatever card count each page has (home, headers, leak,
     resolver, full all use this grid with 1/2/3 cards). Primary card
     stands out via the lighter tile-2 background and the larger IP
     font, not via grid-template width. */
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin: 0;
}

.ip-card {
  background: var(--tile-1);
  color: var(--on-dark);
  border-radius: 18px;
  padding: 24px 28px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
  box-shadow: var(--product-shadow);
}

.ip-card.primary {
  background: var(--tile-2);
}

.ip-card .label {
  font-family: var(--font-text);
  font-size: 12px;
  font-weight: 400;
  line-height: 1;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--body-muted);
}

.ip-card .ip {
  font-family: var(--font-mono);
  font-size: 20px;
  font-weight: 600;
  background: transparent;
  border: 0;
  padding: 0;
  color: var(--on-dark);
  word-break: break-all;
  letter-spacing: -0.02em;
}

.ip-card.primary .ip {
  font-size: 26px;
}

.mono-mute {
  color: var(--body-muted);
}

/* ============================================================
 * Tables (dark widgets)
 * ============================================================ */

table.endpoints {
  width: 100%;
  border-collapse: collapse;
  background: var(--tile-1);
  color: var(--on-dark);
  border-radius: 18px;
  overflow: hidden;
  margin: 16px 0 24px;
  box-shadow: var(--product-shadow);
}

table.endpoints thead th {
  background: var(--tile-3);
  color: var(--body-muted);
  font-family: var(--font-text);
  font-size: 12px;
  font-weight: 600;
  line-height: 1.29;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  text-align: left;
  padding: 14px 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

table.endpoints td {
  text-align: left;
  padding: 16px 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  font-family: var(--font-text);
  font-size: 16px;
  font-weight: 400;
  line-height: 1.4;
  letter-spacing: -0.374px;
  vertical-align: top;
  color: var(--on-dark);
}

table.endpoints tr:last-child td {
  border-bottom: 0;
}

/* ============================================================
 * Code
 * ============================================================ */

/* Inline code on light surfaces */
code {
  font-family: var(--font-mono);
  font-size: 0.94em;
  letter-spacing: -0.02em;
  background: rgba(29, 29, 31, 0.06);
  border-radius: 5px;
  padding: 2px 6px;
  color: var(--ink);
}

/* Inline code inside dark widgets: brighter blue accent */
.ip-card code,
table.endpoints code,
details code:not(pre code),
.notes code,
.verdict code,
.uuid-pill code,
.network-card code {
  background: rgba(255, 255, 255, 0.08);
  color: var(--action-on-dark);
}

/* Pre blocks (dark widgets) */
pre {
  background: var(--tile-1);
  color: var(--on-dark);
  border-radius: 18px;
  padding: 20px 24px;
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: 14px;
  line-height: 1.55;
  margin: 12px 0 20px;
  letter-spacing: -0.02em;
  box-shadow: var(--product-shadow);
}

pre code {
  background: transparent;
  border: 0;
  padding: 0;
  color: var(--on-dark);
  font-size: 1em;
}

/* ============================================================
 * Details (collapsibles) — dark widgets
 * ============================================================ */

details {
  background: var(--tile-1);
  color: var(--on-dark);
  border-radius: 18px;
  margin: 12px 0;
  overflow: hidden;
  box-shadow: var(--product-shadow);
}

details + details {
  margin-top: 12px;
}

details > summary {
  list-style: none;
  cursor: pointer;
  padding: 16px 24px;
  font-family: var(--font-text);
  font-size: 17px;
  font-weight: 600;
  line-height: 1.24;
  letter-spacing: -0.374px;
  color: var(--on-dark);
  display: flex;
  align-items: center;
  gap: 12px;
  user-select: none;
}

details > summary::-webkit-details-marker {
  display: none;
}

details > summary::before {
  content: "+";
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  font-family: var(--font-text);
  font-size: 17px;
  font-weight: 400;
  color: var(--action-on-dark);
  transition: transform 0.15s ease;
}

details[open] > summary::before {
  content: "−";
}

details > summary:hover {
  background: rgba(255, 255, 255, 0.04);
}

details > *:not(summary) {
  padding: 0 24px;
}

/* Paragraphs inside details inherit the dark widget's white text;
   the base `p { color: var(--ink) }` rule would otherwise render
   them as ink-on-tile (invisible). Same goes for code chips and
   plain text. */
details > p,
details > .footnote,
details > div {
  color: var(--on-dark);
}
details > p.footnote {
  color: var(--body-muted);
}

details > pre {
  margin: 0 16px 16px;
  background: rgba(0, 0, 0, 0.32);
  box-shadow: none;
  border-radius: 12px;
}

details > p:last-child,
details > div:last-child {
  padding-bottom: 20px;
}

details.headers > summary {
  padding: 16px 24px;
}

details.headers pre {
  margin: 0 16px 16px;
}

/* ============================================================
 * Links + buttons (pill grammar)
 * ============================================================ */

a {
  color: var(--action);
  text-decoration: none;
  transition: opacity 0.15s ease;
}

a:hover {
  text-decoration: underline;
}

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

/* Links inside dark widgets use the sky variant */
.ip-card a,
table.endpoints a,
details a,
.notes a,
.verdict a,
.network-card a {
  color: var(--action-on-dark);
}

/* Pill button utility (not used in current markup; available for CTAs) */
.btn-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-text);
  font-size: 17px;
  font-weight: 400;
  line-height: 1.24;
  letter-spacing: -0.374px;
  background: var(--action);
  color: var(--on-dark);
  border: 0;
  border-radius: 9999px;
  padding: 11px 22px;
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.15s ease;
}

.btn-pill:hover {
  text-decoration: none;
}

.btn-pill:active {
  transform: scale(0.96);
}

.btn-pill:focus-visible {
  outline: 2px solid var(--action-focus);
  outline-offset: 2px;
}

.btn-pill.ghost {
  background: transparent;
  color: var(--action);
  box-shadow: inset 0 0 0 1px var(--action);
}

/* ============================================================
 * Footer
 * ============================================================ */

footer {
  background: var(--parchment);
  padding: 64px 0 48px;
  text-align: center;
}

footer p {
  font-family: var(--font-text);
  font-size: 12px;
  font-weight: 400;
  line-height: 1.5;
  letter-spacing: -0.12px;
  color: var(--ink-muted-48);
  margin: 4px 0;
}

footer a {
  color: var(--ink-muted-48);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
}

footer a:hover {
  color: var(--ink);
}

footer .heart {
  color: var(--action);
  font-style: normal;
}

/* ============================================================
 * Definition lists (leak page terms)
 * Light-on-parchment, with .pill kept dark for contrast
 * ============================================================ */

dl.terms {
  margin: 16px 0 0;
}

dl.terms dt {
  font-family: var(--font-text);
  font-size: 17px;
  font-weight: 600;
  line-height: 1.24;
  letter-spacing: -0.374px;
  color: var(--ink);
  margin-top: 24px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

dl.terms dt:first-child {
  margin-top: 0;
}

dl.terms dd {
  margin: 8px 0 0;
  font-family: var(--font-text);
  font-size: 17px;
  font-weight: 400;
  line-height: 1.47;
  letter-spacing: -0.374px;
  color: var(--ink-muted-80);
}

/* aria-current on body links (rare; ensure no surprise) */
[aria-current="page"]:not(.masthead nav a) {
  color: var(--ink);
}

/* ============================================================
 * Reduced motion
 * ============================================================ */

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

/* ============================================================
 * Mobile (Apple's tablet-portrait breakpoint: 833px and below)
 * Stops here: the global nav swaps to a hamburger.
 * ============================================================ */

@media (max-width: 833px) {
  .hero {
    padding: 64px 0 32px;
  }

  section {
    padding: 48px 0;
  }
}

/* ============================================================
 * Phone (640px and below)
 * Tighter padding, single-column IP grid, stackable tables.
 * ============================================================ */

@media (max-width: 640px) {
  .container {
    padding-left: max(16px, env(safe-area-inset-left));
    padding-right: max(16px, env(safe-area-inset-right));
  }

  /* Masthead: brand left, hamburger right, nav drops down. */
  .masthead .container {
    gap: 0;
  }

  .nav-toggle {
    display: block;
  }

  .masthead nav {
    display: none;
    position: fixed;
    top: 44px;
    left: 0;
    right: 0;
    margin: 0;
    flex-direction: column;
    gap: 0;
    background: var(--black);
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    padding: 8px 0 12px;
    z-index: 99;
    box-shadow: rgba(0, 0, 0, 0.4) 0 12px 24px 0;
    padding-left: env(safe-area-inset-left);
    padding-right: env(safe-area-inset-right);
  }

  body.nav-open .masthead nav {
    display: flex;
  }

  body.nav-open {
    overflow: hidden;
  }

  .masthead nav a {
    font-size: 15px;
    padding: 14px 24px;
    opacity: 1;
  }

  .masthead nav a[aria-current="page"] {
    color: var(--action-on-dark);
  }

  /* Hero */
  .hero {
    padding: 48px 0 24px;
  }
  .hero h1 {
    font-size: 32px;
    letter-spacing: -0.4px;
  }
  .hero p {
    font-size: 19px;
    margin-bottom: 24px;
  }

  /* Section spacing */
  section {
    padding: 40px 0;
  }
  section.hero {
    padding: 48px 0 24px;
  }

  h2 {
    font-size: 24px;
    margin-bottom: 16px;
    letter-spacing: -0.22px;
  }

  /* IP cards stack */
  .ip-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }
  .ip-card {
    padding: 20px 22px;
    border-radius: 14px;
  }
  .ip-card .ip {
    font-size: 18px;
  }
  .ip-card.primary .ip {
    font-size: 22px;
  }

  /* Tables: tighter padding */
  table.endpoints {
    border-radius: 14px;
  }
  table.endpoints thead th {
    padding: 10px 14px;
    font-size: 11px;
  }
  table.endpoints td {
    padding: 12px 14px;
    font-size: 14px;
  }

  /* Stackable tables: each row collapses into a card */
  table.endpoints.stackable {
    background: transparent;
    box-shadow: none;
    border-radius: 0;
  }
  table.endpoints.stackable thead {
    display: none;
  }
  table.endpoints.stackable tbody {
    display: block;
  }
  table.endpoints.stackable tr {
    display: block;
    background: var(--tile-1);
    border-radius: 14px;
    padding: 14px 16px;
    margin-bottom: 10px;
    box-shadow: var(--product-shadow);
  }
  table.endpoints.stackable tr:last-child {
    margin-bottom: 0;
  }
  table.endpoints.stackable td {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 12px;
    padding: 4px 0;
    border: 0;
    font-size: 14px;
  }
  table.endpoints.stackable td::before {
    content: attr(data-label);
    color: var(--body-muted);
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    font-weight: 600;
    flex-shrink: 0;
  }
  table.endpoints.stackable td:empty {
    display: none;
  }
  table.endpoints.stackable td > * {
    text-align: right;
    word-break: break-all;
    min-width: 0;
  }

  /* Details */
  details {
    border-radius: 14px;
  }
  details > summary {
    padding: 16px 18px;
    font-size: 16px;
  }
  details > *:not(summary) {
    padding: 0 18px;
  }
  details > pre {
    margin: 0 12px 12px;
    padding: 14px 16px;
    font-size: 12.5px;
    border-radius: 10px;
  }

  /* Pre */
  pre {
    padding: 14px 16px;
    font-size: 12.5px;
    border-radius: 14px;
  }

  /* dl.terms */
  dl.terms dt {
    font-size: 16px;
  }
  dl.terms dd {
    font-size: 15px;
  }

  /* Footer */
  footer {
    padding: 48px 0 32px;
  }
}

/* ============================================================
 * Small phone (380px and below)
 * ============================================================ */

@media (max-width: 380px) {
  .brand {
    font-size: 13px;
  }
  .hero h1 {
    font-size: 28px;
  }
  .hero p {
    font-size: 17px;
  }
  h2 {
    font-size: 22px;
  }
}
