/* ============================================================
   popupcities.org — components
   Implements the Thou Ārt design system link styles, buttons,
   menus and surfaces. Every hover/motion spec here is traced to
   a named style in docs/design-system source (see README).
   ============================================================ */

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: var(--fs-body);
  line-height: var(--lh-body);
  letter-spacing: var(--ls-tight);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a { color: inherit; text-decoration: none; }
a:focus-visible, button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: var(--r-xs);
}

h1, h2, h3, h4 { margin: 0; font-weight: 600; letter-spacing: -0.015em; line-height: 1.25; }
p { margin: 0 0 var(--p-space); }
p:last-child { margin-bottom: 0; }

/* ============ Link styles (traced) ============ */

/* "Link 4" — THE CANONICAL LINK. Use .link for every content link.
   Solid accent underline offset 3px; hover → accent text on apple-grey. */
.link {
  color: var(--ink);
  text-decoration: underline;
  text-decoration-color: var(--accent);
  text-underline-offset: 3px;
  border-radius: var(--r-xs);
  transition: color var(--dur-fast) var(--ease), background-color var(--dur-fast) var(--ease);
}
.link:hover {
  color: var(--accent);
  background-color: var(--pc-apple-grey);
  text-decoration-color: var(--accent);
}

/* "Accent Blue" (alternate, not canonical): ink text, 2px dashed accent
   underline; hover → white text on accent block. */
.link-accent {
  color: var(--ink);
  text-decoration: underline;
  text-decoration-color: var(--accent);
  text-decoration-thickness: 2px;
  text-decoration-style: dashed;
  text-underline-offset: 3px;
  transition: color var(--dur) var(--ease), background-color var(--dur) var(--ease);
}
.link-accent:hover {
  color: var(--pc-white);
  background-color: var(--accent);
  text-decoration-color: var(--accent);
}

/* "Link" (alternate, not canonical — prefer .link): hover thickens + accent text. */
.link-solid {
  text-decoration: underline;
  text-decoration-color: var(--accent);
  text-underline-offset: 3px;
  transition: color var(--dur-fast) var(--ease);
}
.link-solid:hover {
  color: var(--accent);
  text-decoration-thickness: 2px;
}

/* "Link 3" (top nav): hover fades to 25% ink. */
.link-nav {
  color: var(--ink);
  transition: color var(--dur) var(--ease);
}
.link-nav:hover { color: var(--pc-black-025); }
/* current nav tab: bold + thick accent bottom line (see .nav-links) */

/* "bottom menu" (footer links): faint at rest; hover → #858585 with a
   1px underline, 3px offset, skip-ink auto; current page → same underline. */
.link-foot {
  color: var(--faint);
  transition: color var(--dur-fast) var(--ease);
}
.link-foot:hover {
  color: var(--pc-dark-grey-2);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  text-decoration-skip-ink: auto;
}
.link-foot[aria-current="page"] {
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

/* "Research Author": dashed ink underline; hover → white on ink. */
.link-author {
  color: var(--ink);
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-decoration-style: dashed;
  text-underline-offset: 3px;
  transition: color var(--dur-fast) var(--ease), background-color var(--dur-fast) var(--ease);
}
.link-author:hover {
  color: var(--pc-white);
  background-color: var(--ink);
  text-decoration-color: var(--accent);
}

/* "codeblock style": dark-blue on blue-light chip; hover inverts to accent. */
code, .code {
  font-family: var(--sans);
  font-size: 0.92em;
  color: var(--pc-dark-blue);
  background: var(--pc-blue-light);
  border-radius: var(--r-xs);
  padding: 1px 4px;
}
a code:hover, a.code:hover {
  color: var(--pc-white);
  background: var(--accent);
}

/* ============ Buttons (observed: pill, 1px, 10/16) ============ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--sans);
  font-size: var(--fs-note);
  font-weight: 500;
  border-radius: var(--r-pill);
  padding: var(--btn-pad);
  cursor: pointer;
  transition: background-color var(--dur) var(--ease), color var(--dur) var(--ease),
              border-color var(--dur) var(--ease);
}
.btn-primary {          /* accent pill (live "Enquiry form" / "Contact us") */
  background: var(--accent);
  color: var(--pc-white);
  border: 1px solid var(--accent);
}
.btn-primary:hover { background: var(--pc-dark-blue); border-color: var(--pc-dark-blue); }
.btn-outline {          /* observed: transparent, 1px solid ink, r100 */
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--ink);
}
.btn-outline:hover {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--pc-white);
}
.btn-quiet {
  background: var(--panel);
  color: var(--muted);
  border: 1px solid var(--border);
}
.btn-quiet:hover { color: var(--ink); background: var(--paper); }

/* ============ Header ============ */
header.site {
  position: sticky;
  top: 0;
  z-index: 60;
  background: rgba(255, 255, 255, 0.86);
  backdrop-filter: saturate(150%) blur(10px);
  -webkit-backdrop-filter: saturate(150%) blur(10px);
  border-bottom: 1px solid var(--border);
}
.nav {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 var(--gutter);
  height: var(--nav-h);
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 16px;
}
.wordmark {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  font-weight: 600;
  font-size: var(--fs-body);
  letter-spacing: -0.02em;
}
.wordmark .glyph {
  width: 24px; height: 24px;
  border-radius: 6px;
  background: var(--accent);
  position: relative;
  flex: none;
  transition: background-color var(--dur) var(--ease);
}
.wordmark:hover .glyph { background: var(--pc-dark-blue); }
.wordmark .glyph::before,
.wordmark .glyph::after {
  content: "";
  position: absolute;
  background: var(--pc-white);
  border-radius: 1px;
}
.wordmark .glyph::before { left: 6px;  top: 6px; width: 5px; height: 12px; }
.wordmark .glyph::after  { left: 13px; top: 9px; width: 5px; height: 9px; opacity: 0.72; }
.nav-links { display: flex; gap: 16px; font-size: var(--fs-ui); line-height: var(--lh-ui); flex-wrap: wrap; align-self: stretch; }
.nav-links a {
  display: flex;
  align-items: center;
  height: var(--nav-h);
  border-bottom: 2px solid transparent;
  padding-top: 2px;   /* keeps text optically centered against the border */
}
.nav-links a[aria-current="page"] {
  font-weight: 600;
  color: var(--accent);
  border-bottom-color: var(--accent);
}

/* ============ Construction banner ============ */
.banner {
  background: var(--tint);
  border-bottom: 1px solid var(--border);
}
.banner-inner {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 10px var(--gutter);
  display: flex;
  align-items: center;
  gap: 0.75rem 1rem;
  flex-wrap: wrap;
  font-size: var(--fs-note);
}
.banner-inner p { margin: 0; color: var(--ink); }
.banner-inner .btns { display: flex; gap: 0.5rem; margin-left: auto; }
@media (max-width: 600px) { .banner-inner .btns { margin-left: 0; } }
.btn-sm { padding: 6px 12px; font-size: var(--fs-fine); }

/* ============ Shell ============ */
.shell {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 24px var(--gutter) 80px;
  display: grid;
  grid-template-columns: 1fr;
  gap: 24px;
  align-items: start;
}
@media (min-width: 900px) {
  .shell {
    grid-template-columns: var(--sidebar-w) minmax(0, var(--main-w));
    justify-content: start;   /* left-aligned; right rail stays empty */
    gap: var(--col-gap);
  }
}

/* ============ Sidebar (research side tab) ============ */
.sidebar { position: static; padding: 0 10px; }
@media (min-width: 900px) { .sidebar { position: sticky; top: 70px; } }

/* Grey group frame: apple-grey, 5px pad, r12, 10px apart */
.side-frame {
  background: var(--panel);
  border-radius: var(--r-md);
  padding: var(--side-frame-pad);
  margin-bottom: 10px;
}
.side-frame:last-child { margin-bottom: 0; }

.side-title {
  display: inline-block;          /* pill hugs its text */
  margin: 2px 0 7px 5px;
  font-size: var(--fs-ui);
  line-height: var(--lh-tab);
  font-weight: 600;
  color: var(--pc-white);
  background: var(--accent);
  padding: 0 8px;
  border-radius: 6px;
  letter-spacing: var(--ls-tight);
}
.side-group { display: flex; flex-direction: column; gap: 5px; }

.tab {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  text-align: left;
  font-family: var(--sans);
  font-size: var(--fs-ui);
  font-weight: 600;
  line-height: var(--lh-tab);
  letter-spacing: var(--ls-tight);
  color: var(--ink);
  background: var(--paper);
  border: none;
  border-radius: var(--r-sm);
  padding: 10px;
  cursor: pointer;
  transition: background-color var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease);
}
.tab:hover { background: var(--pc-offwhite); }
/* Current section: faded to 25% ink ("Link 3" current-state), NOT tinted */
.tab[aria-selected="true"] { color: var(--pc-black-025); background: var(--paper); }
.tab .ico { width: var(--icon-size); height: var(--icon-size); flex: none; color: var(--icon-color); }
.tab[aria-selected="true"] .ico { color: var(--pc-black-025); }

.badge {
  margin-left: auto;
  font-size: var(--fs-badge);
  font-weight: 600;
  line-height: var(--lh-badge);
  letter-spacing: var(--ls-tight);
  color: var(--accent);
  background: var(--tint);
  border-radius: var(--r-xs);
  padding: 1px 5px;
}

.side-label {
  font-size: var(--fs-ui);
  line-height: var(--lh-tab);
  font-weight: 500;
  padding: 2px 10px;
  border-radius: var(--r-sm);
  margin-bottom: 5px;
}
.side-label:only-child { margin-bottom: 0; }
.side-label.accent { color: var(--accent); background: var(--tint); }
.side-label.plain  { color: var(--muted); background: transparent; }

.post-link {
  display: block;
  font-size: var(--fs-ui);
  line-height: var(--lh-tab);
  letter-spacing: var(--ls-tight);
  color: var(--ink);
  background: var(--paper);
  border: none;
  border-radius: var(--r-sm);
  padding: 10px;
  transition: background-color var(--dur-fast) var(--ease);
}
.post-link:hover { background: var(--pc-offwhite); }
.post-link.dim { color: var(--faint); }

/* ============ Panels & content ============ */
.panel[hidden] { display: none; }
.panel { animation: appear var(--dur) var(--ease); }

.hero {
  background: var(--accent);
  border-radius: var(--r-md);
  padding: 22px;
  color: var(--pc-white);
  margin-bottom: 22px;
}
.hero .kicker {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  opacity: 0.78;
  margin-bottom: 0.7rem;
}
.hero h1 { font-size: clamp(24px, 4vw, var(--fs-title)); font-weight: 700; margin-bottom: 0.6rem; }
.hero p {
  font-family: var(--serif);
  font-size: 17px;
  line-height: 1.5;
  opacity: 0.94;
  max-width: 62ch;
}

.panel h1.plain { font-size: clamp(22px, 3.2vw, var(--fs-title)); font-weight: 700; margin-bottom: 0.5rem; }
.lede {
  font-family: var(--serif);
  font-size: var(--fs-lede);
  line-height: var(--lh-lede);
  color: var(--pc-dark-grey);
  max-width: 64ch;
  margin-bottom: 1.4rem;
}

.meta-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
  padding-bottom: 1.2rem;
  margin-bottom: 1.4rem;
  border-bottom: 1px solid var(--border);
}
.avatar {
  width: 22px; height: 22px; border-radius: 50%;
  background: var(--accent); color: var(--pc-white);
  font-size: 8px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  flex: none;
}
.meta-row .who { font-size: var(--fs-note); font-weight: 500; }
.meta-row .when { font-size: var(--fs-note); color: var(--muted); }
.meta-row .end { margin-left: auto; }

.prose { max-width: 72ch; }
.prose h2 {
  font-family: var(--serif);
  font-size: 22px;
  font-weight: 600;
  letter-spacing: 0;
  margin: 2rem 0 0.7rem;
}
.prose h2:first-child { margin-top: 0; }
.prose ul { margin: 0 0 1rem; padding-left: 1.1rem; }
.prose li { margin-bottom: 0.4rem; }

.callout {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 14px 16px;
  font-size: 14px;
  color: var(--muted);
  margin: 1.4rem 0;
}
.callout strong { color: var(--ink); font-weight: 600; }

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
  margin: 1.5rem 0;
}
.stat {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 14px;
}
.stat .n { font-family: var(--serif); font-size: 26px; font-weight: 600; letter-spacing: -0.01em; display: block; }
.stat .l { font-size: var(--fs-fine); color: var(--muted); line-height: 1.4; display: block; margin-top: 0.15rem; }

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 12px;
  margin: 1.4rem 0;
}
.card {
  display: block;
  background: var(--paper);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 15px;
  transition: border-color var(--dur-fast) var(--ease), background-color var(--dur-fast) var(--ease);
}
a.card:hover { border-color: var(--accent); background: var(--panel); }
.card h3 { font-size: 14px; margin-bottom: 0.3rem; }
.card p { font-size: var(--fs-note); color: var(--muted); line-height: 1.5; }

/* ============ Directory table (db row) ============ */
.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  margin: 1.4rem 0;
}
table { border-collapse: collapse; width: 100%; min-width: 720px; font-size: var(--fs-note); }
th, td { text-align: left; padding: 9px 14px; border-bottom: 1px solid var(--border); white-space: nowrap; }
td.wrap { white-space: normal; min-width: 160px; }
th {
  background: var(--panel);
  font-weight: 600;
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}
tbody tr:last-child td { border-bottom: 0; }
tbody tr { transition: background-color var(--dur-fast) var(--ease); }
tbody tr:hover { background: var(--panel); }
.pill {
  display: inline-block;
  font-size: 11px;
  font-weight: 500;
  padding: 1px 8px;
  border-radius: var(--r-pill);
  background: var(--tint);
  color: var(--accent);
}
.pill.grey { background: var(--panel); color: var(--muted); }
.pill.bluegrey { background: var(--pc-blue-grey); color: var(--pc-dark-blue); }

/* ============ Newsletter (mirrors thouartofficial.com report page) ============ */
.newsletter { margin-top: 56px; }
.nl-head {
  font-size: 19px;
  font-weight: 500;
  line-height: 1.5;
  letter-spacing: var(--ls-tight);
  color: var(--ink);
  margin: 0 0 4px;
}
.nl-head strong { font-weight: 600; }
.nl-sub { margin: 0 0 16px; max-width: 62ch; }
.newsletter iframe { display: block; width: 100%; max-width: 480px; height: 150px; border: 0; background: var(--pc-white); }

/* ============ Footer (bottom menu) ============ */
footer.site { border-top: 1px solid var(--border); background: var(--paper); }  /* menu bg is pure white */
.foot {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 36px var(--gutter) 20px;
}
.foot-cols {
  font-size: var(--fs-ui);
  line-height: var(--lh-flat);
  padding-bottom: 28px;
}
.foot-cols > div { margin-bottom: 28px; }
.foot-cols > div:last-child { margin-bottom: 0; }
.foot h4 { font-size: var(--fs-ui); line-height: var(--lh-flat); font-weight: 400; letter-spacing: var(--ls-tight); margin: 0 0 10px; color: var(--muted); }
.foot-cols a { display: block; margin-bottom: 10px; width: fit-content; }
.foot-bar-band { border-top: 1px solid var(--border); }   /* full-bleed divider */
.foot-bar {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 16px var(--gutter) 20px;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 1.2rem;
  align-items: center;
  font-size: var(--fs-fine);
  color: var(--muted);
}
.foot-bar .right { margin-left: auto; display: flex; gap: 1.2rem; }

/* ============ Motion ============ */
@keyframes appear {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: none; }
}
.reveal { animation: appear var(--dur) var(--ease) backwards; }
.reveal:nth-child(2) { animation-delay: 0.06s; }
.reveal:nth-child(3) { animation-delay: 0.12s; }
.reveal:nth-child(4) { animation-delay: 0.18s; }

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

.skip {
  position: absolute; left: -9999px;
  background: var(--accent); color: var(--pc-white);
  padding: 0.5rem 0.9rem; border-radius: var(--r-sm); z-index: 100;
}
.skip:focus { left: 12px; top: 10px; }
