/* josemotta.com — site styles.
   Every value references a token from tokens.css (generated from docs/tokens.json).
   `npm run check` fails on any raw colour, px value or duration in this file. */

/* ---------- Fonts: self-hosted, Latin subset, OFL (see licenses/fonts) ---------- */

@font-face {
  font-family: "Instrument Serif";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("../fonts/instrument-serif-400.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC,
    U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215,
    U+FEFF, U+FFFD;
}

@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("../fonts/inter-400.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC,
    U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215,
    U+FEFF, U+FFFD;
}

@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("../fonts/inter-500.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC,
    U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215,
    U+FEFF, U+FFFD;
}

@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("../fonts/inter-600.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC,
    U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215,
    U+FEFF, U+FFFD;
}

@font-face {
  font-family: "JetBrains Mono";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("../fonts/jetbrains-mono-400.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC,
    U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215,
    U+FEFF, U+FFFD;
}

/* ---------- Layout variables (derived from tokens only) ---------- */

:root {
  --gutter: var(--space-4);
  --section-gap: var(--space-7);            /* below 768px */
  --section-half: calc(var(--section-gap) / 2);
  --card-pad: var(--space-3);
  /* Sticky header: nav line (small = 24px line-height = space-4) + vertical padding + rule. */
  --header-height: calc(var(--space-4) + 2 * var(--space-3) + var(--hairline));
}

@media (min-width: 768px) {
  :root {
    --section-gap: var(--space-8);
    --card-pad: var(--space-4);
  }
}

/* ---------- Base ---------- */

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

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

body {
  margin: 0;
  background: var(--surface);
  color: var(--ink);
  font: var(--text-body);
  letter-spacing: var(--tracking-body);
  -webkit-font-smoothing: antialiased;
}

h1,
h2,
h3,
p,
ul,
ol,
table {
  margin: 0;
}

ul {
  padding: 0;
  list-style: none;
}

h1,
h2,
h3 {
  text-wrap: balance;
}

p {
  text-wrap: pretty;
}

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

[id] {
  scroll-margin-top: 0;
}

main:focus {
  outline: none; /* programmatic target of the skip link, not an interactive control */
}

/* ---------- Type utilities the generated classes don't cover ---------- */

.label {
  text-transform: uppercase;
  color: var(--ink-subtle); /* legal on surface and surface-sunken only */
}

/* ---------- Links ---------- */

a {
  color: var(--accent);
  text-decoration-line: underline;
  text-decoration-thickness: var(--hairline);
  text-underline-offset: var(--underline-offset);
}

a:hover,
a:focus-visible {
  text-decoration-thickness: var(--underline-hover);
}

/* ---------- Focus: ink outline, every interactive element. Never removed. ---------- */

:focus-visible {
  outline: var(--focus-width) solid var(--ink);
  outline-offset: var(--focus-offset);
}

/* ---------- Skip link ---------- */

.skip-link {
  position: fixed;
  top: var(--space-3);
  left: var(--space-3);
  z-index: 2;
  padding: var(--space-2) var(--space-3);
  background: var(--surface);
  color: var(--ink);
  border: var(--hairline) solid var(--border-strong);
  font: var(--text-small);
  transform: translateY(calc(-100% - 2 * var(--space-3)));
}

.skip-link:focus {
  transform: none;
}

/* ---------- Frame and sections ---------- */

.frame {
  width: 100%;
  max-width: calc(var(--measure-wide) + 2 * var(--gutter));
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.prose {
  max-width: var(--measure-prose);
}

.prose > * + * {
  margin-top: var(--space-3);
}

/* Sections: a hairline rule centred in a section-gap of whitespace. */
.section {
  padding-block: var(--section-half);
}

.section + .section {
  padding-top: 0;
}

.section + .section > .frame::before {
  content: "";
  display: block;
  border-top: var(--hairline) solid var(--border);
  margin-bottom: var(--section-half);
}

/* The rule under the hero is the one that must be seen. */
.hero + .section > .frame::before {
  border-top-color: var(--border-strong);
}

/* Recessed band: the background change is the separator, edged with hairlines. */
.section--band,
.section + .section--band {
  padding-block: var(--section-half);
  background: var(--surface-sunken);
  border-block: var(--hairline) solid var(--border);
}

.section + .section--band > .frame::before,
.section--band + .section > .frame::before {
  display: none;
}

.section--band + .section {
  padding-top: var(--section-half);
}

.section__title {
  margin-bottom: var(--space-5);
}

/* ---------- Header and nav ---------- */

.site-header {
  background: var(--surface);
  border-bottom: var(--hairline) solid var(--border);
}

.site-nav {
  padding-block: var(--space-3);
}

.site-nav ul {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-1) var(--space-4);
}

.site-nav a {
  display: block;
  font: var(--text-small);
  letter-spacing: var(--tracking-small);
  color: var(--ink-muted);
  text-decoration-line: none;
}

.site-nav a:hover,
.site-nav a:focus-visible {
  text-decoration-line: underline;
}

.site-nav a[aria-current] {
  color: var(--accent);
  text-decoration-line: underline;
}

@media (min-width: 768px) {
  .site-header {
    position: sticky;
    top: 0;
    z-index: 1;
  }

  .site-nav {
    display: flex;
    align-items: center;
    height: calc(var(--header-height) - var(--hairline));
    padding-block: 0;
  }

  [id] {
    scroll-margin-top: var(--header-height);
  }
}

/* ---------- Hero ---------- */

.hero__role {
  color: var(--ink-muted);
}

.prose > .hero__role {
  margin-top: var(--space-2);
}

.prose > .hero__tagline {
  margin-top: var(--space-5);
}

.prose > .link-row {
  margin-top: var(--space-4);
}

.link-row {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: var(--space-2) var(--space-4);
}

/* ---------- Project cards ---------- */

.cards {
  display: grid;
  gap: var(--space-4);
}

/* A card is a prose column with padding: measure-prose plus its gutters and
   hairline border, so card body text sets at the same measure as the page. */
.card {
  display: grid;
  gap: var(--space-4);
  max-width: calc(var(--measure-prose) + 2 * var(--card-pad) + 2 * var(--hairline));
  padding: var(--card-pad);
  background: var(--surface-raised);
  border: var(--hairline) solid var(--border);
  border-radius: var(--radius-md);
}

/* Two-step hierarchy: project name in title, summary line in subtitle. */
.card__head .subtitle {
  margin-top: var(--space-1);
  color: var(--ink-muted);
}

.prose > .card__head + * {
  margin-top: var(--space-4);
}

.card__status {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: var(--space-2);
}

/* On surface-raised, labels step up to ink-muted. */
.card__label {
  font: var(--text-label);
  letter-spacing: var(--tracking-label);
  text-transform: uppercase;
  color: var(--ink-muted);
}

/* ---------- Tags ---------- */

.tags {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: var(--space-1);
}

.tag {
  font: var(--text-mono);
  letter-spacing: var(--tracking-mono);
  color: var(--ink-muted);
  padding: var(--space-1) var(--space-2);
  border: var(--hairline) solid var(--border);
  border-radius: var(--radius-sm);
}

/* ---------- Entries (experience, education) ---------- */

.entries {
  display: grid;
  gap: var(--space-6);
  max-width: var(--measure-prose);
}

.entry__meta {
  margin-top: var(--space-2);
  font: var(--text-small);
  letter-spacing: var(--tracking-small);
  color: var(--ink-muted);
}

.entry__text {
  margin-top: var(--space-3);
  font: var(--text-small);
  letter-spacing: var(--tracking-small);
}

.note {
  margin-top: var(--space-5);
  max-width: var(--measure-prose);
  font: var(--text-small);
  letter-spacing: var(--tracking-small);
  color: var(--ink-muted);
}

/* ---------- Stack band ---------- */

.stack {
  display: grid;
  gap: var(--space-4);
}

.stack__group {
  display: grid;
  gap: var(--space-2);
}

@media (min-width: 768px) {
  .stack__group {
    grid-template-columns: minmax(0, 1fr) minmax(0, 3fr);
    gap: var(--space-4);
    align-items: baseline;
  }
}

/* ---------- Languages ---------- */

.lang-table {
  width: 100%;
  max-width: var(--measure-prose);
  border-collapse: collapse;
}

.lang-table th,
.lang-table td {
  padding: var(--space-2) var(--space-4) var(--space-2) 0;
  border-bottom: var(--hairline) solid var(--border);
  text-align: left;
  vertical-align: baseline;
}

.lang-table thead th {
  padding-bottom: var(--space-2);
}

.lang-table tbody th {
  font-weight: inherit;
}

/* ---------- Contact ---------- */

.prose > .contact-links {
  margin-top: var(--space-4);
}

.contact-links {
  display: grid;
  gap: var(--space-3);
}

.contact-links li {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2) var(--space-3);
}

.contact-link {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
}

.contact-link--pending {
  color: var(--ink-muted);
}

.icon {
  flex: none;
  width: var(--space-3);
  height: var(--space-3);
}

.copy-button {
  font: var(--text-small);
  letter-spacing: var(--tracking-small);
  color: var(--ink);
  background: transparent;
  padding: var(--space-1) var(--space-3);
  border: var(--hairline) solid var(--border-strong);
  border-radius: var(--radius-full);
  cursor: pointer;
}

.copy-button:hover {
  border-color: var(--ink-muted);
}

.copy-button[hidden] {
  display: none;
}

.copy-status {
  font: var(--text-small);
  letter-spacing: var(--tracking-small);
  color: var(--ink-muted);
}

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

.site-footer {
  padding-block: var(--space-5);
  background: var(--surface-sunken);
  border-top: var(--hairline) solid var(--border);
  font: var(--text-small);
  letter-spacing: var(--tracking-small);
  color: var(--ink-muted);
}

/* ---------- TODO markers: gaps in the copy, visible until filled ---------- */

.todo {
  font: var(--text-mono);
  letter-spacing: var(--tracking-mono);
  color: var(--ink);
  padding: 0 var(--space-1);
  border: var(--hairline) dashed var(--accent);
  overflow-wrap: anywhere;
}

.todo--block {
  display: block;
  padding: var(--space-2) var(--space-3);
}

.tag.todo {
  padding: var(--space-1) var(--space-2);
  border-radius: var(--radius-none);
}

/* ---------- Motion: opacity + space-2 translate on scroll-in, once ----------
   Content is visible by default. The hidden state applies only when site.js has
   finished wiring the observer and added .reveal-ready to <html>, so a blocked,
   failed or erroring script can never leave the page blank. */

@media (prefers-reduced-motion: no-preference) {
  .reveal-ready [data-reveal] {
    transition:
      opacity var(--motion-fast) ease-out,
      transform var(--motion-fast) ease-out;
  }

  .reveal-ready [data-reveal].is-pending {
    opacity: 0;
    transform: translateY(var(--space-2));
  }
}

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

@media print {
  .reveal-ready [data-reveal].is-pending {
    opacity: 1;
    transform: none;
  }
}
