/* ---------------------------------------------------------------
   Talysson Oliveira — portfolio site
   Plain CSS, no build step. Custom properties drive light/dark.
   --------------------------------------------------------------- */

:root {
  --bg: #ffffff;
  --bg-raised: #f5f5f4;
  --bg-inset: #eeeeec;
  --text: #17181a;
  --text-muted: #52565c;
  --border: #dcdcda;          /* decorative: dividers, card edges — not a UI boundary */
  --border-interactive: #8d8d89; /* UI boundary: inputs, secondary buttons — verified >=3:1 (WCAG 1.4.11) */
  --accent: #0f6f5c;
  --accent-contrast: #ffffff;
  --error: #b0453a;           /* verified >=4.5:1 on --bg in light; see design-system.html */
  --status-live-bg: #e4f4ee;
  --status-live-text: #0f6f5c;
  --status-active-bg: #eef1fb;
  --status-active-text: #33409a;
  --status-shipped-bg: #f5eee0;
  --status-shipped-text: #8a6417;
  --focus-ring: #0f6f5c;

  --font-body: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-mono: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  --max-width: 72rem;

  /* ---- spacing scale — 8px/0.5rem base, every value below is already
     in use somewhere on the site; this just names what was ad hoc. ---- */
  --space-1: 0.25rem;   /* 4px  */
  --space-2: 0.5rem;    /* 8px  */
  --space-3: 0.75rem;   /* 12px */
  --space-4: 1rem;      /* 16px */
  --space-5: 1.5rem;    /* 24px */
  --space-6: 2rem;      /* 32px */
  --space-7: 2.5rem;    /* 40px */
  --space-8: 3rem;      /* 48px */
  --space-9: 4rem;      /* 64px */
  --space-10: 6rem;     /* 96px */

  /* ---- type scale — fluid (clamp), named by role not size. Existing
     hero/section sizes are formalized here unchanged; --text-display
     is the one new, elevated role for design-system.html. ---- */
  --text-display: clamp(2.75rem, 2.1rem + 3vw, 4.5rem);
  --text-h1: clamp(2rem, 4.5vw, 3rem);   /* identical curve to the pre-existing .hero h1 */
  --text-h2: clamp(1.5rem, 3vw, 2rem);   /* identical curve to the pre-existing .section h2 */
  --text-h3: 1.1rem;                     /* matches the pre-existing .project-card h3 */
  --text-h4: 0.95rem;
  --text-body-lg: 1.15rem;
  --text-body: 1rem;
  --text-body-sm: 0.9rem;
  --text-caption: 0.8rem;
  --text-mono-label: 0.85rem;

  /* ---- motion — purposeful only: confirms hover/focus/reveal, never
     decorative-idle. Silenced entirely under reduced motion below. ---- */
  --ease-standard: cubic-bezier(0.2, 0, 0, 1);
  --duration-fast: 120ms;
  --duration-base: 200ms;
  --duration-slow: 420ms;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121314;
    --bg-raised: #1b1c1e;
    --bg-inset: #202124;
    --text: #f2f2f0;
    --text-muted: #b3b6bb;
    --border: #33353a;
    --border-interactive: #6c6f76; /* verified >=3:1 on --bg and --bg-raised */
    --accent: #4fd8b9;
    --accent-contrast: #0a0f0d;
    --error: #e5897c;           /* dark-mode error was unset (inherited light #b0453a
                                    at 3.33:1 on dark bg — fails AA 4.5:1 for text).
                                    This value verified at 7.26:1. */
    --status-live-bg: #12332b;
    --status-live-text: #7fe7cd;
    --status-active-bg: #1f2440;
    --status-active-text: #b3bdf7;
    --status-shipped-bg: #33290f;
    --status-shipped-text: #e9c471;
    --focus-ring: #4fd8b9;
  }
}

/* Respect the user's OS-level motion preference everywhere at once,
   rather than special-casing every animated rule. */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}

* { box-sizing: border-box; }

html { color-scheme: light dark; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; display: block; }

a { color: var(--accent); }

.wrap {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 1.5rem;
}

.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  left: -999px;
  top: auto;
  background: var(--accent);
  color: var(--accent-contrast);
  padding: 0.75rem 1rem;
  z-index: 100;
  border-radius: 0 0 0.4rem 0;
}
.skip-link:focus {
  left: 0;
  top: 0;
}

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

/* ---------- scroll reveal ----------
   Purposeful, not decorative: confirms a section has entered view, once.
   Gated on .js-reveal-ready (set by script.js only after it confirms
   IntersectionObserver exists) so content is always visible by default —
   this can only ever add motion, never hide content if JS fails. */
.js-reveal-ready [data-reveal] {
  opacity: 0;
  transform: translateY(12px);
  transition: opacity var(--duration-slow) var(--ease-standard),
              transform var(--duration-slow) var(--ease-standard);
}
.js-reveal-ready [data-reveal].is-visible {
  opacity: 1;
  transform: none;
}

/* ---------- header ---------- */

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

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 1rem;
  padding-bottom: 1rem;
  flex-wrap: wrap;
}

.brand {
  font-weight: 700;
  font-size: 1.1rem;
  text-decoration: none;
  color: var(--text);
}

.nav-toggle {
  display: none;
  background: none;
  border: 1px solid var(--border);
  border-radius: 0.4rem;
  padding: 0.5rem 0.75rem;
  cursor: pointer;
}

.nav-toggle-bar,
.nav-toggle-bar::before,
.nav-toggle-bar::after {
  display: block;
  width: 1.25rem;
  height: 2px;
  background: var(--text);
  position: relative;
}
.nav-toggle-bar::before { content: ""; top: -6px; }
.nav-toggle-bar::after { content: ""; top: 4px; }

.site-nav ul {
  list-style: none;
  display: flex;
  gap: 1.5rem;
  margin: 0;
  padding: 0;
}

.site-nav a {
  text-decoration: none;
  color: var(--text-muted);
  font-weight: 500;
  transition: color var(--duration-fast) var(--ease-standard);
}
.site-nav a:hover,
.site-nav a[aria-current="page"] {
  color: var(--text);
}

@media (max-width: 40rem) {
  .nav-toggle { display: inline-flex; align-items: center; }

  .site-nav {
    display: none;
    width: 100%;
    order: 3;
    padding-top: 1rem;
  }
  .site-nav.is-open { display: block; }
  .site-nav ul {
    flex-direction: column;
    gap: 0.75rem;
  }
}

/* ---------- hero ---------- */

.hero {
  padding: var(--space-9) var(--space-5) var(--space-8);
  max-width: 46rem;
}

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: var(--text-caption);
  font-weight: 700;
  color: var(--accent);
  margin: 0 0 0.75rem;
}

.hero h1 {
  font-size: var(--text-h1);
  line-height: 1.1;
  margin: 0 0 1rem;
}

.hero-lede {
  font-size: var(--text-body-lg);
  color: var(--text-muted);
  margin: 0 0 2rem;
  max-width: 40ch;
}

.cta-row {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

.btn {
  display: inline-block;
  padding: 0.75rem 1.5rem;
  border-radius: 0.5rem;
  text-decoration: none;
  font-weight: 600;
  border: 1px solid transparent;
  transition: transform var(--duration-fast) var(--ease-standard),
              opacity var(--duration-fast) var(--ease-standard),
              border-color var(--duration-fast) var(--ease-standard);
}

.btn-primary {
  background: var(--accent);
  color: var(--accent-contrast);
}
.btn-primary:hover { opacity: 0.9; transform: translateY(-1px); }
.btn-primary:active { opacity: 1; transform: translateY(0); }

.btn-secondary {
  background: transparent;
  color: var(--text);
  border-color: var(--border-interactive);
}
.btn-secondary:hover { border-color: var(--accent); transform: translateY(-1px); }
.btn-secondary:active { transform: translateY(0); }

/* ---------- proof strip ---------- */

.proof {
  background: var(--bg-raised);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  padding: var(--space-7) 0;
}

.proof-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.5rem;
}

@media (max-width: 48rem) {
  .proof-grid { grid-template-columns: repeat(2, 1fr); }
}

.proof-figure {
  font-size: 1.75rem;
  font-weight: 800;
  color: var(--accent);
  margin: 0 0 0.35rem;
  font-family: var(--font-mono);
}

.proof-label {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.9rem;
}

/* ---------- generic section ---------- */

.section {
  padding: var(--space-9) 0;
}

.section h2 {
  font-size: var(--text-h2);
  margin: 0 0 0.5rem;
}

.section-lede {
  color: var(--text-muted);
  margin: 0 0 2.5rem;
  max-width: 60ch;
}

/* ---------- projects ---------- */

.project-grid {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(19rem, 1fr));
  gap: 1.5rem;
}

.project-card {
  border: 1px solid var(--border);
  border-radius: 0.75rem;
  padding: 1.5rem;
  background: var(--bg-raised);
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  transition: border-color var(--duration-base) var(--ease-standard),
              transform var(--duration-base) var(--ease-standard),
              box-shadow var(--duration-base) var(--ease-standard);
}

.project-card:hover,
.project-card:focus-within {
  border-color: var(--border-interactive);
  transform: translateY(-2px);
  box-shadow: 0 8px 20px -12px rgb(0 0 0 / 0.25);
}

.project-card-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.project-card h3 {
  margin: 0;
  font-size: var(--text-h3);
}

.project-status {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  white-space: nowrap;
}
.status-live { background: var(--status-live-bg); color: var(--status-live-text); }
.status-active { background: var(--status-active-bg); color: var(--status-active-text); }
.status-shipped { background: var(--status-shipped-bg); color: var(--status-shipped-text); }

.project-card p {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.95rem;
}

.tag-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.tag-list li {
  font-size: 0.75rem;
  background: var(--bg-inset);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.15rem 0.6rem;
  color: var(--text-muted);
}

.project-link {
  margin-top: auto;
  font-weight: 600;
  text-decoration: none;
  font-size: 0.9rem;
}
.project-link:hover { text-decoration: underline; }

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

/* ---------- CTA band ---------- */

.cta-band {
  background: var(--bg-inset);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.cta-band-inner {
  text-align: center;
  max-width: 34rem;
}

.cta-band h2 { margin-bottom: 0.75rem; }
.cta-band p {
  color: var(--text-muted);
  margin: 0 0 1.75rem;
}

/* ---------- contact ---------- */

.contact-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  max-width: 30rem;
}

.contact-list li {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}

.contact-label {
  font-weight: 700;
  color: var(--text-muted);
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* ---------- footer ---------- */

.site-footer {
  border-top: 1px solid var(--border);
  padding: 2rem 0;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.footer-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
}

.footer-inner nav a {
  color: var(--text-muted);
  text-decoration: none;
  margin-left: 1rem;
}
.footer-inner nav a:hover { color: var(--text); }

/* ---------- about page ---------- */

.timeline {
  list-style: none;
  margin: 0;
  padding: 0;
  border-left: 2px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

.timeline li {
  padding-left: 1.5rem;
  position: relative;
}

.timeline li::before {
  content: "";
  position: absolute;
  left: -0.4375rem;
  top: 0.3rem;
  width: 0.75rem;
  height: 0.75rem;
  border-radius: 50%;
  background: var(--accent);
}

.timeline h3 {
  margin: 0 0 0.35rem;
  font-size: 1.05rem;
}

.timeline p {
  margin: 0;
  color: var(--text-muted);
}

.skill-groups {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr));
  gap: 1.5rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.skill-group {
  border: 1px solid var(--border);
  border-radius: 0.75rem;
  padding: 1.25rem 1.5rem;
  background: var(--bg-raised);
}

.skill-group h3 {
  margin: 0 0 0.75rem;
  font-size: var(--text-h4);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}

.skill-group ul {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.skill-group li {
  font-size: 0.85rem;
  background: var(--bg-inset);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.2rem 0.7rem;
}

/* ---------- case studies ---------- */

.case-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.5rem;
  margin: 0 0 1.5rem;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.case-meta strong { color: var(--text); }

.case-block {
  max-width: 62ch;
  margin: 0 0 1.25rem;
  color: var(--text-muted);
}

.case-block:last-child { margin-bottom: 0; }

.callout {
  border: 1px solid var(--border);
  border-left: 4px solid var(--accent);
  border-radius: 0.5rem;
  padding: 1rem 1.25rem;
  background: var(--bg-raised);
  max-width: 62ch;
  margin: 0 0 1.5rem;
}

.callout p { margin: 0 0 0.5rem; color: var(--text-muted); }
.callout p:last-child { margin-bottom: 0; }
.callout-label {
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-size: 0.75rem;
  color: var(--text);
  display: block;
  margin-bottom: 0.4rem;
}

.stat-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr));
  gap: 1rem;
  max-width: 40rem;
  margin: 0 0 1.5rem;
}

.stat-box {
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  padding: 0.85rem 1rem;
  background: var(--bg-inset);
}

.stat-box .figure {
  font-family: var(--font-mono);
  font-weight: 800;
  font-size: 1.15rem;
  color: var(--accent);
}

.stat-box .label {
  display: block;
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 0.15rem;
}

/* ---------- contact form ---------- */

.contact-form {
  max-width: 30rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.form-field { display: flex; flex-direction: column; gap: 0.35rem; }

.form-field label {
  font-weight: 600;
  font-size: 0.9rem;
}

.form-field input,
.form-field textarea {
  font: inherit;
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--border-interactive);
  border-radius: 0.5rem;
  background: var(--bg);
  color: var(--text);
  transition: border-color var(--duration-fast) var(--ease-standard);
}

.form-field input:focus,
.form-field textarea:focus {
  outline: 3px solid var(--focus-ring);
  outline-offset: 1px;
}

/* Honeypot: hidden from sighted users and kept out of the tab order,
   but still present in the DOM and readable by non-JS bots that
   fill in every field indiscriminately. */
.hp-field {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.form-status {
  font-size: 0.85rem;
  min-height: 1.2em;
}
.form-status[data-state="ok"] { color: var(--status-live-text); }
.form-status[data-state="error"] { color: var(--error); }

.btn[disabled] {
  opacity: 0.6;
  cursor: not-allowed;
}

/* ---------- design-system.html demo page ---------- */

.ds-idea {
  border-left: 4px solid var(--accent);
  padding: 1.25rem 1.5rem;
  background: var(--bg-raised);
  border-radius: 0 0.5rem 0.5rem 0;
  max-width: 62ch;
}

.ds-block { margin: 0 0 3rem; }
.ds-block:last-child { margin-bottom: 0; }

.ds-block h3 {
  font-size: var(--text-h3);
  margin: 0 0 0.35rem;
}

.ds-block-note {
  color: var(--text-muted);
  max-width: 62ch;
  margin: 0 0 1.5rem;
  font-size: var(--text-body-sm);
}

.ds-type-row {
  display: flex;
  align-items: baseline;
  gap: 1.5rem;
  padding: 1rem 0;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}
.ds-type-row:last-child { border-bottom: none; }

.ds-type-sample { flex: 1 1 20rem; margin: 0; }
.ds-type-meta {
  font-family: var(--font-mono);
  font-size: var(--text-caption);
  color: var(--text-muted);
  white-space: nowrap;
}

.ds-swatch-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr));
  gap: 1rem;
}

.ds-swatch {
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  overflow: hidden;
}

.ds-swatch-color {
  height: 3.5rem;
}

.ds-swatch-body {
  padding: 0.75rem 1rem;
  font-size: var(--text-body-sm);
}

.ds-swatch-role {
  display: block;
  font-weight: 600;
}

.ds-swatch-meta {
  display: flex;
  justify-content: space-between;
  font-family: var(--font-mono);
  font-size: var(--text-caption);
  color: var(--text-muted);
  margin-top: 0.35rem;
}

.ds-pass { color: var(--status-live-text); font-weight: 700; }
.ds-fail { color: var(--error); font-weight: 700; }

.ds-space-row {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.5rem 0;
}

.ds-space-bar {
  height: 0.75rem;
  background: var(--accent);
  border-radius: 0.2rem;
}

.ds-space-label {
  font-family: var(--font-mono);
  font-size: var(--text-caption);
  color: var(--text-muted);
  width: 11rem;
  flex-shrink: 0;
}

.ds-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-body-sm);
}

.ds-table th,
.ds-table td {
  text-align: left;
  padding: 0.6rem 0.75rem;
  border-bottom: 1px solid var(--border);
}

.ds-table th {
  color: var(--text-muted);
  font-size: var(--text-caption);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  font-weight: 700;
}

.ds-table td:not(:first-child) {
  font-family: var(--font-mono);
}

.ds-state-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: center;
}

.ds-state-grid .btn { margin: 0; }

.ds-motion-demo {
  border: 1px dashed var(--border);
  border-radius: 0.5rem;
  padding: 1.5rem;
  text-align: center;
  color: var(--text-muted);
  font-size: var(--text-body-sm);
}

/* ---------- loading state ----------
   Button: text stays legible (no icon-only spinner replacing the label),
   a small mono indicator communicates "in progress" without motion
   under prefers-reduced-motion. Use aria-busy="true" + keep the button
   disabled while a submit is in flight. */
.btn[aria-busy="true"] {
  position: relative;
  color: transparent;
  pointer-events: none;
}

.btn[aria-busy="true"]::after {
  content: "";
  position: absolute;
  inset: 0;
  margin: auto;
  width: 1rem;
  height: 1rem;
  border-radius: 50%;
  border: 2px solid currentColor;
  border-top-color: transparent;
  color: var(--accent-contrast);
  animation: btn-spin 0.7s linear infinite;
}

@media (prefers-reduced-motion: reduce) {
  .btn[aria-busy="true"] {
    color: inherit;
  }
  .btn[aria-busy="true"]::after { display: none; }
  .btn[aria-busy="true"]::before {
    content: "Working…";
  }
}

@keyframes btn-spin {
  to { transform: rotate(360deg); }
}

/* Skeleton: content placeholder for data not yet loaded (e.g. a future
   async project list). Shimmer under normal motion; a flat muted block
   under reduced motion — never invisible, never spinning indefinitely. */
.skeleton {
  background: var(--bg-inset);
  border-radius: 0.4rem;
  position: relative;
  overflow: hidden;
  color: transparent;
}

.skeleton::after {
  content: "";
  position: absolute;
  inset: 0;
  transform: translateX(-100%);
  background: linear-gradient(90deg, transparent, var(--bg-raised), transparent);
  animation: skeleton-sweep 1.6s ease-in-out infinite;
}

@media (prefers-reduced-motion: reduce) {
  .skeleton::after { display: none; }
}

@keyframes skeleton-sweep {
  100% { transform: translateX(100%); }
}
