/* Tachyons .gray (#777777) fails WCAG AA contrast (4.48:1 on white, 4.07:1 on #f4f4f4); darken to pass at 4.5:1+ */
.gray {
  color: #666666;
}

/* Pin footer to bottom of viewport */
body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}
main[role="main"] {
  flex: 1;
  padding-bottom: 0 !important;
}

/* Wider content container for pages (Projects, About, etc.) */
.page-content-wide {
  width: 80%;
  max-width: 80%;
}

@media (max-width: 960px) {
  .page-content-wide {
    width: 100%;
    max-width: 100%;
  }
}

/* Copy-to-clipboard button on code blocks */
.copy-code-btn {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  padding: 0.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #444;
  color: #fff;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.2s;
  line-height: 1;
}
pre:hover .copy-code-btn,
.highlight:hover .copy-code-btn,
.code-block-wrapper:hover .copy-code-btn {
  opacity: 1;
}

/* Typography matched to resonateperf.com */
:root {
  --sans: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;
}
body,
.avenir {
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
}
code, pre, kbd, samp, .code {
  font-family: var(--mono);
}

/* Theme matched to resonateperf.com (dark, mint accent) */
:root {
  --bg: #1a1f2b;
  --bg-alt: #212736;
  --surface: #262d3d;
  --border: #38415a;
  --text: #eceff5;
  --muted: #b0b9cc;
  --accent: #37e2b4;
  --accent-ink: #04130e;
  --accent-2: #6aa8ff;
  --radius: 14px;
}
html { background: var(--bg); color-scheme: dark; }
:root[data-theme="light"] { color-scheme: light; }
body, body.bg-near-white { background: var(--bg); color: var(--text); }

/* Tachyons colour utilities remapped to the palette */
body .bg-near-white { background-color: var(--bg); }
body .bg-black { background-color: var(--bg-alt); border-color: var(--border); }
body .bg-white { background-color: var(--surface); }
body .dark-gray, body .near-black, body .black { color: var(--text); }
body .mid-gray, body .gray { color: var(--muted); }
body .b--light-gray, body .b--moon-gray { border-color: var(--border); }
body .shadow-4 { box-shadow: none; border: 1px solid var(--border); }
body .br3 { border-radius: var(--radius); }
body .hover-blue:hover, body .hover-blue:focus { color: var(--accent); }

/* Navigation / header / footer */
header nav { border-bottom: 1px solid rgba(255, 255, 255, 0.12); }
header .bg-black nav { border-bottom-color: var(--border); }
header nav a:hover, footer a:hover { color: var(--accent); }
footer { border-top: 1px solid var(--border); }

/* Content links */
.nested-copy-line-height a,
#projects-content a,
article a:not(.link):not(.no-underline) {
  color: var(--accent);
  text-decoration: none;
}
.nested-copy-line-height a:hover,
#projects-content a:hover { text-decoration: underline; }

/* Headings */
article h1, article h2, article h3 { color: var(--text); letter-spacing: -0.02em; }

/* Tables */
table { border-collapse: collapse; }
table th { color: var(--text); background: var(--surface); }
table th, table td { border-color: var(--border); }
table tr:nth-child(even) td { background: var(--bg-alt); }
table, table td, table th { border-color: var(--border) !important; }

/* Inputs and tabs */
input[type="search"] {
  background: var(--surface);
  color: var(--text);
  border-color: var(--border);
  border-radius: 10px;
}
input[type="search"]::placeholder { color: var(--muted); }
input[type="search"]:focus { border-color: var(--accent); }
.guide-tab.bg-dark-gray { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.guide-tab.bg-white { background: var(--surface); color: var(--text); }

/* Code */
code {
  background: color-mix(in srgb, var(--accent) 10%, transparent);
  border-radius: 5px;
  padding: .1em .35em;
}
pre { background: #141823; border: 1px solid var(--border); border-radius: 10px; color: #c9d1e0; }
pre code { background: none; padding: 0; }

/* Allow line breaks in page descriptions */
header h2 { white-space: pre-line; }

/* Light theme (Resonate's light palette) */
:root[data-theme="light"] {
  --bg: #f1f4f9;
  --bg-alt: #e6ebf3;
  --surface: #ffffff;
  --border: #c5cedd;
  --text: #0e131d;
  --muted: #3b4659;
  --accent: #067a5b;
  --accent-ink: #ffffff;
  --accent-2: #2a62d4;
}
/* Stronger contrast in light mode: visible card edges, table stripes and icons */
:root[data-theme="light"] .bg-white { box-shadow: 0 1px 2px rgba(14, 19, 29, 0.08); }
:root[data-theme="light"] table tr:nth-child(even) td { background: #e9edf5; }
:root[data-theme="light"] table th { background: #dde3ee; }
:root[data-theme="light"] a.link-transition svg,
:root[data-theme="light"] a.link-transition svg path { fill: #3b4659; }
:root[data-theme="light"] a.link-transition:hover svg,
:root[data-theme="light"] a.link-transition:hover svg path { fill: var(--accent); }
/* Footer and image-less headers sit on --bg-alt, so their text must follow the theme */
:root[data-theme="light"] footer a,
:root[data-theme="light"] footer .white-70,
:root[data-theme="light"] footer .white-50 { color: var(--muted); }
:root[data-theme="light"] footer a:hover { color: var(--accent); }
:root[data-theme="light"] header .bg-black h1,
:root[data-theme="light"] header .bg-black h2,
:root[data-theme="light"] header .bg-black nav a { color: var(--text); }

/* Theme toggle button */
.theme-toggle {
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: 999px;
  color: #fff;
  cursor: pointer;
  font-size: 1.1rem;
  line-height: 1;
  margin-right: 0.75rem;
  padding: 0.4rem 0.65rem;
}
.theme-toggle:hover { background: rgba(255, 255, 255, 0.25); }
:root[data-theme="light"] header .bg-black .theme-toggle {
  background: var(--surface);
  border-color: var(--border);
  color: var(--text);
}

/* Header without background image (compact) */
header > div { padding-bottom: 0.5rem !important; }
header > div > div { padding-top: 0.25rem !important; padding-bottom: 0 !important; }
header h1 { font-size: 2.25rem !important; line-height: 1.2 !important; margin: 0 !important; }
header h2 { margin: 0.25rem 0 0.5rem !important; font-size: 1.1rem !important; max-width: none !important; text-align: left !important; }

header h2.header-centered { text-align: center !important; }

/* Body text sized like resonateperf.com (16px / 1.6) */
html { font-size: 16px; }
body { font-size: 1rem; line-height: 1.6; }
body .f4, body .f4-ns { font-size: 1rem; }
body .f5, body .f5-ns { font-size: 0.9rem; }
body .lh-copy { line-height: 1.6; }
body table { font-size: 0.95rem; }
body table td:first-child { white-space: nowrap; }

/* Header subtitle matches body text */
header h2 {
  font-size: 1rem !important;
  font-weight: 400 !important;
  line-height: 1.6 !important;
  color: var(--muted) !important;
  max-width: 46rem !important;
}
header h2.header-centered { max-width: 46rem !important; margin-left: auto !important; margin-right: auto !important; text-align: center !important; }

/* Pull the text up close to the line under the nav */
header > div > div { padding-top: 0 !important; }
header h2 { margin-top: 0 !important; }
header h1 { margin-top: 0 !important; }

/* Line under the nav sits closer to the nav links */
header nav { padding-bottom: 0.5rem !important; }
@media screen and (min-width: 60em) {
  header nav { padding-bottom: 0 !important; }
  header nav > div { margin-bottom: -0.35rem; }
}

/* Breathing room between the nav line and the subtitle */
header h2 { margin-top: 1.25rem !important; margin-bottom: 1rem !important; }

/* Keep multilingual headings from breaking inside words (e.g. Korean) */
article h2 { word-break: keep-all; text-wrap: balance; }

/* Scrolling multilingual welcome */
.marquee {
  overflow: hidden;
  white-space: nowrap;
  -webkit-mask-image: linear-gradient(to right, transparent, #000 10%, #000 90%, transparent);
  mask-image: linear-gradient(to right, transparent, #000 10%, #000 90%, transparent);
}
.marquee-track {
  display: inline-flex;
  animation: marquee-scroll 28s linear infinite;
}
.marquee:hover .marquee-track { animation-play-state: paused; }
.marquee-group { display: inline-flex; flex-shrink: 0; }
.marquee-item {
  color: var(--text);
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  padding: 0 1.25rem;
}
.marquee-item::after {
  color: var(--accent);
  content: "\00b7";
  margin-left: 2.5rem;
}
@keyframes marquee-scroll {
  from { transform: translateX(0); }
  to { transform: translateX(-50%); }
}
@media (prefers-reduced-motion: reduce) {
  .marquee { white-space: normal; -webkit-mask-image: none; mask-image: none; }
  .marquee-track { animation: none; flex-wrap: wrap; justify-content: center; }
  .marquee-group:nth-child(2) { display: none; }
}

/* Home page "View all projects" link */
main section > p a { color: var(--accent); text-decoration: none; }
main section > p a:hover { text-decoration: underline; }

/* Language icon on home page Featured cards */
.lang-icon { flex-shrink: 0; margin-left: 0.75rem; }

/* About page photo */
.about img {
  border-radius: var(--radius);
  display: block;
  height: auto;
  margin: 1.5rem auto 0;
  max-width: min(100%, 110px);
}
