/* The one font the first screen can't do without: Instrument Serif, the title card's name and every heading.
   It comes with the page's stylesheet; the rest (fonts.css) follow the first paint on the home page. */
@font-face { font-family: 'Instrument Serif'; font-style: normal; font-weight: 400; font-display: swap; src: url(/fonts/instrument-serif.woff2) format('woff2'); }

/* The site's fonts, served from /fonts/ (latin subset from Google Fonts, which covers Portuguese).
   Instrument Serif + Inter carry the film; each project borrows its product's own type:
   Barlow Condensed for track2.fit, Fraunces for Jump Over Jump. Inter and Fraunces are variable.
   Instrument Serif's upright face is in fonts-title.css. On a first visit to the home page these come
   after the first paint, under the title card (app/actions/document.tsx), so the words paint at once.
   /fonts/ is cached for a year (scripts/build.ts), so a changed font needs a new file name. */
@font-face { font-family: 'Instrument Serif'; font-style: italic; font-weight: 400; font-display: swap; src: url(/fonts/instrument-serif-italic.woff2) format('woff2'); }
@font-face { font-family: 'Inter'; font-style: normal; font-weight: 300 600; font-display: swap; src: url(/fonts/inter.woff2) format('woff2'); }
@font-face { font-family: 'Barlow Condensed'; font-style: italic; font-weight: 700; font-display: swap; src: url(/fonts/barlow-condensed-700-italic.woff2) format('woff2'); }
@font-face { font-family: 'Barlow Condensed'; font-style: italic; font-weight: 800; font-display: swap; src: url(/fonts/barlow-condensed-800-italic.woff2) format('woff2'); }
@font-face { font-family: 'Fraunces'; font-style: normal; font-weight: 500 600; font-display: swap; src: url(/fonts/fraunces.woff2) format('woff2'); }
@font-face { font-family: 'Fraunces'; font-style: italic; font-weight: 500; font-display: swap; src: url(/fonts/fraunces-italic.woff2) format('woff2'); }

/* A small reset shared by the site. */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body { margin: 0; -webkit-font-smoothing: antialiased; }
h1, h2, h3, p, figure, blockquote { margin: 0; }
ul, ol { margin: 0; padding: 0; list-style: none; }
a { color: inherit; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; animation-delay: 0s !important; animation-timeline: none !important; transition-duration: 0.01ms !important; }
}

/* What every page shares (the home page and each post): the colours and type, the focus ring and skip link,
   the cursor, the fixed menu with its flags, the buttons, the contact links, the footer and the film grain.
   The home page's rows and sections are in home.css. */
.cin {
  --bg: #070707; --text: #ece7df; --dim: #9a948a; --amber: #e8b86a; --teal: #6fb7c4; --line: rgb(236 231 223 / 0.14);
  --serif: 'Instrument Serif', 'Iowan Old Style', Georgia, serif;
  --sans: 'Inter', system-ui, sans-serif;
  --t2f: 'Barlow Condensed', 'Arial Narrow', sans-serif;
  --joj: 'Fraunces', Georgia, serif;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --move: 1s cubic-bezier(0.22, 1, 0.36, 1);
  /* the page's side margin */
  --gut: clamp(1.25rem, 4vw, 4rem);
  background: var(--bg); color: var(--text); font: 300 1.0625rem/1.7 var(--sans);
}
.cin ::selection { background: var(--amber); color: #111; }
.cin h1, .cin h2, .cin h3 { font-family: var(--serif); font-weight: 400; line-height: 0.98; letter-spacing: -0.01em; }
.cin em { font-style: italic; color: var(--amber); }
.cin a { text-decoration-color: rgb(232 184 106 / 0.5); text-underline-offset: 0.2em; }
.cin-kicker { font: 500 0.75rem/1 var(--sans); letter-spacing: 0.28em; text-transform: uppercase; color: var(--amber); }

/* ---------- keyboard: one visible focus ring everywhere ---------- */
.cin :focus-visible { outline: 2px solid var(--amber); outline-offset: 3px; }
main:focus { outline: none; }

/* ---------- cursor ---------- */
.cur { position: fixed; z-index: 1500; left: 0; top: 0; width: 34px; height: 34px; margin: -17px 0 0 -17px; border-radius: 50%; border: 1px solid rgb(236 231 223 / 0.6); pointer-events: none; opacity: 0; display: grid; place-items: center; transition: width 0.35s var(--ease), height 0.35s var(--ease), margin 0.35s var(--ease), background 0.3s, border-color 0.3s, opacity 0.3s; mix-blend-mode: difference; }
.cur[data-on='true'] { opacity: 1; }
.cur[data-mode='link'] { width: 56px; height: 56px; margin: -28px 0 0 -28px; border-color: #fff; }
/* over buttons with words (.cin-btn, the email links) only the system pointer shows: the ring would cover them */
.cur[data-mode='none'] { opacity: 0; }
.cur[data-mode]:not([data-mode='']):not([data-mode='link']):not([data-mode='none']) { width: 84px; height: 84px; margin: -42px 0 0 -42px; background: #fff; mix-blend-mode: normal; border-color: #fff; }
.cur-label { font: 600 0.62rem/1 var(--sans); letter-spacing: 0.2em; text-transform: uppercase; color: #111; }

/* ---------- fixed navigation: logo, three links and the language switch ---------- */
.cin-nav { position: fixed; z-index: 60; inset: 0 0 auto 0; display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: 0.9rem clamp(1rem, 3vw, 2.5rem); color: #fff; background: linear-gradient(rgb(7 7 7 / 0.82), rgb(7 7 7 / 0.55)); backdrop-filter: blur(14px) saturate(1.2); -webkit-backdrop-filter: blur(14px) saturate(1.2); border-bottom: 1px solid rgb(255 255 255 / 0.06); }
.cin-mark { display: inline-grid; place-items: center; min-width: 2.75rem; min-height: 2.75rem; margin-left: -0.6rem; font: 400 1.5rem/1 var(--serif); letter-spacing: 0.04em; text-decoration: none; }
.cin-menu { display: flex; margin-left: auto; gap: clamp(0.9rem, 2.4vw, 2.4rem); }
/* language switch: two flag cards fanned like a hand. Each card (the link) stays put so its hover
   area never moves; only the face inside it moves. Entering the hand gives both cards a jiggle;
   the card under the pointer pops up and stands straight. The current language is ringed. */
.cin-langs { position: relative; flex: none; width: 4.2rem; height: 2.5rem; margin: 0; }
/* the link is the 2rem-wide tap target; the flag face inside it stays card-sized */
.lang-card { --lean: 8deg; position: absolute; top: 0.25rem; left: 50%; width: 2rem; height: 2rem; margin-left: -1rem; display: grid; place-items: center; transform-origin: 50% 135%; transition: transform 0.45s cubic-bezier(0.3, 1.5, 0.5, 1); }
.lang-en { transform: translateX(-0.55rem) rotate(calc(var(--lean) * -1)); }
.lang-pt { transform: translateX(0.55rem) rotate(var(--lean)); }
.lang-card[aria-current] { --lean: 5deg; z-index: 2; }
.lang-face { display: block; width: 1.4rem; height: 1.95rem; border-radius: 5px; overflow: hidden; box-shadow: 0 0 0 1.5px #0b0b0b; filter: saturate(0.45) brightness(0.85); transition: transform 0.4s cubic-bezier(0.3, 1.5, 0.5, 1), filter 0.3s, box-shadow 0.3s; }
.lang-face .flag { display: block; width: 100%; height: 100%; }
.lang-card[aria-current] .lang-face { filter: none; box-shadow: 0 0 0 1.5px #0b0b0b, 0 0 0 3px var(--amber); }
.lang-card:focus-visible { outline-offset: 1px; border-radius: 6px; }
@media (hover: hover) {
  .cin-langs:hover .lang-face { animation: jiggle 0.6s ease-in-out; }
  .cin-langs:hover .lang-pt .lang-face { animation-delay: 0.08s; }
  .lang-card:hover { z-index: 3; }
  .lang-en:hover .lang-face { transform: translateY(-6px) rotate(var(--lean)) scale(1.08); filter: none; }
  .lang-pt:hover .lang-face { transform: translateY(-6px) rotate(calc(var(--lean) * -1)) scale(1.08); filter: none; }
}
@keyframes jiggle { 30% { translate: 0 -3px; rotate: -4deg; } 60% { translate: 0 0; rotate: 3deg; } }
@media (prefers-reduced-motion: reduce) { .cin-langs:hover .lang-face { animation: none; } }
.cin-menu a { position: relative; display: inline-flex; align-items: center; min-height: 2.75rem; text-decoration: none; font: 500 0.75rem/1 var(--sans); letter-spacing: 0.16em; text-transform: uppercase; padding-block: 0.4rem; opacity: 0.62; transition: opacity 0.3s; white-space: nowrap; }
.cin-menu a::after { content: ''; position: absolute; left: 0; right: 0; bottom: 0.45rem; height: 1px; background: currentColor; transform: scaleX(0); transform-origin: left; transition: transform 0.6s var(--ease); }
.cin-menu a:hover, .cin-menu a[aria-current], .cin-menu a:focus-visible { opacity: 1; }
.cin-menu a[aria-current]::after { transform: scaleX(1); }
/* wide screens: all six in one line (the More list is just part of it there); the home page's More and its
   pause are in home.css */
.menu-more { display: contents; }
/* between phones and wide screens the menu loses its letter-spacing before anything else */
@media (max-width: 1100px) { .cin-menu { gap: 1.1rem; } .cin-menu a { letter-spacing: 0.1em; } }
/* phones: Career, Projects and Contact (the home page puts Contact under its More: home.css). The links keep
   44px of height to tap, and spread across the space between the logo and the flags. */
@media (max-width: 760px) {
  .cin-nav { gap: 0.25rem; padding-block: 0.4rem; padding-inline: 1rem 0.5rem; }
  .cin-menu { gap: 0; justify-content: center; flex: 1; }
  .cin-menu .menu-wide { display: none; }
  .cin-menu a { padding-inline: 0.45rem; letter-spacing: 0.06em; }
  .cin-menu a::after { left: 0.45rem; right: 0.45rem; }
  /* the flags: each card's tap area is 44px square and they sit side by side; the faces still fan */
  .cin-langs { width: 5.5rem; height: 2.75rem; }
  .lang-card { top: 0; width: 2.75rem; height: 2.75rem; margin-left: -1.375rem; }
  .lang-en { transform: translateX(-1.375rem) rotate(calc(var(--lean) * -1)); }
  .lang-pt { transform: translateX(1.375rem) rotate(var(--lean)); }
  .lang-en .lang-face { translate: 0.8rem 0; }
  .lang-pt .lang-face { translate: -0.8rem 0; }
}

/* ---------- buttons ---------- */
.cin-btn { display: inline-flex; align-items: center; gap: 0.7rem; padding: 0.95rem 1.5rem; border-radius: 999px; background: var(--text); color: #0b0b0b; text-decoration: none; font: 600 0.82rem/1 var(--sans); letter-spacing: 0.08em; text-transform: uppercase; transition: transform 0.5s var(--ease), box-shadow 0.5s var(--ease); }
.cin-btn:hover { transform: translateY(-3px); box-shadow: 0 16px 40px -14px rgb(236 231 223 / 0.5); }
.cin-btn span { transition: transform 0.4s var(--ease); }
.cin-btn:hover span { transform: translateX(5px); }
.cin-btn-joj { background: #ee9b6b; }
/* "How I built it · soon": a note beside the button, not a second button */
.cin-soon { font: italic 400 1.05rem/1.3 var(--serif); color: var(--dim); }

/* ---------- Hi: links ---------- */
/* contact links: email as the main button, then a row of equal social tiles (icon over label) */
.links { display: grid; gap: 1.1rem; justify-items: start; margin-top: 0.6rem; }
.foot-links { justify-items: center; }
.link-email { display: inline-flex; align-items: center; gap: 0.7rem; padding: 0.9rem 1.4rem; border-radius: 999px; background: var(--amber); color: #111; text-decoration: none; font: 500 1rem/1 var(--sans); transition: transform 0.4s var(--ease), box-shadow 0.4s var(--ease); }
.link-email:hover { transform: translateY(-2px); box-shadow: 0 14px 34px -12px rgb(232 184 106 / 0.7); }
.link-email .social-icon { width: 1.35rem; height: 1.35rem; }
.socials { display: grid; grid-template-columns: repeat(6, 5.6rem); gap: 0.6rem; }
.socials a { display: grid; justify-items: center; align-content: center; gap: 0.6rem; height: 5.6rem; border-radius: 18px; border: 1px solid var(--line); background: rgb(255 255 255 / 0.025); color: var(--text); text-decoration: none; font: 500 0.75rem/1 var(--sans); letter-spacing: 0.04em; transition: color 0.3s, border-color 0.3s, background 0.3s, transform 0.4s var(--ease); }
.socials a:hover { color: var(--amber); border-color: rgb(232 184 106 / 0.55); background: rgb(232 184 106 / 0.07); transform: translateY(-3px); }
.socials .social-icon { width: 1.75rem; height: 1.75rem; }
.social-icon { flex: none; display: block; }
.social-sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
@media (max-width: 720px) {
  .foot-links { width: min(100%, 26rem); }
  .socials { grid-template-columns: repeat(6, minmax(2.75rem, 1fr)); justify-self: stretch; gap: 0.45rem; }
  .socials a { height: auto; aspect-ratio: 1; border-radius: 16px; }
  .socials span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
  .socials .social-icon { width: 1.55rem; height: 1.55rem; }
  .link-email { font-size: 0.95rem; }
}


/* ---------- footer ---------- */
.cin-foot { display: grid; justify-items: center; text-align: center; gap: 1.6rem; padding: clamp(6rem, 14vh, 9rem) 1.5rem 8rem; background: radial-gradient(70% 50% at 50% 0%, rgb(111 183 196 / 0.1), transparent 70%), #050505; }
.cin-foot h2 { font-size: clamp(4rem, 2rem + 9vw, 10rem); }
.foot-links { justify-content: center; }
.cin-fine { font-size: 0.8rem; color: var(--dim); }

/* ---------- film grain ---------- */
.cin::after { content: ''; position: fixed; inset: 0; z-index: 900; pointer-events: none; opacity: 0.07; mix-blend-mode: overlay; background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 1  0 0 0 0 1  0 0 0 0 1  0 0 0 0.9 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>"); animation: grain 0.8s steps(4) infinite; }
@keyframes grain { 0% { transform: translate(0, 0); } 25% { transform: translate(-3%, 2%); } 50% { transform: translate(2%, -3%); } 75% { transform: translate(-2%, -1%); } }


.post-meta { display: flex; flex-wrap: wrap; gap: 0.3rem 0.9rem; margin: 0; font: 500 0.75rem/1.3 var(--sans); letter-spacing: 0.14em; text-transform: uppercase; color: var(--dim); }
.post-tags { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.post-tags li { padding: 0.35rem 0.6rem; border-radius: 999px; border: 1px solid var(--line); color: #d9d3c8; font: 500 0.75rem/1 var(--sans); letter-spacing: 0.04em; }

/* the grain holds still for reduced motion, and while the page's motion is paused (rails.tsx) */
.is-paused .cin::after { animation-play-state: paused; }
@media (prefers-reduced-motion: reduce) { .cin::after { animation: none; } }

/* A single post: a calm reading column under the same menu as the home page. */
.post-main { padding: clamp(6rem, 12vh, 8rem) var(--gut) clamp(3rem, 8vh, 6rem); }
.post-page .skip-link { position: absolute; z-index: 1; left: 1rem; top: 0.4rem; padding: 0.65rem 1rem; border-radius: 999px; background: var(--amber); color: #111; font-weight: 600; text-decoration: none; transform: translateY(-200%); }
.post-page .skip-link:focus { transform: none; }
@media (max-width: 380px) {
  .post-page .cin-nav { padding-inline: 0.75rem 0.5rem; }
  .post-page .cin-menu a { padding-inline: 0.15rem; font-size: 0.7rem; letter-spacing: 0; }
}
/* one column that never grows past the screen */
.post { max-width: 44rem; margin: 0 auto; display: grid; grid-template-columns: minmax(0, 1fr); gap: 1.1rem; }
.post-back { justify-self: start; display: inline-flex; gap: 0.5rem; align-items: center; color: var(--dim); text-decoration: none; font: 500 0.7rem/1 var(--sans); letter-spacing: 0.2em; text-transform: uppercase; transition: color 0.3s; }
.post-back:hover { color: var(--amber); }
.post-back span { transition: translate 0.4s var(--ease); }
.post-back:hover span { translate: -4px 0; }
.post h1 { font-size: clamp(2.4rem, 1.4rem + 3.6vw, 4.4rem); line-height: 1; letter-spacing: -0.015em; }
.post-translation { justify-self: start; display: inline-flex; gap: 0.5rem; padding: 0.55rem 0.9rem; border-radius: 999px; border: 1px solid rgb(232 184 106 / 0.45); color: var(--amber); text-decoration: none; font: 500 0.78rem/1 var(--sans); transition: background 0.3s; }
.post-translation:hover { background: rgb(232 184 106 / 0.1); }
.post-video { margin: 0.6rem 0 0; display: grid; gap: 0.5rem; }
.post-player { width: 100%; aspect-ratio: 16 / 9; border: 0; border-radius: 16px; background: #000; }
.post-play { display: grid; place-items: center; padding: 0; background: radial-gradient(ellipse at center, #242321, #0f0e0d 75%); border: 1px solid var(--line); font: inherit; text-align: center; text-decoration: none; cursor: pointer; }
.post-play span { display: grid; justify-items: center; gap: 0.65rem; color: var(--text); font-size: 0.9rem; }
.post-play svg { width: 2.8rem; height: 2.8rem; padding: 0.65rem; fill: #0f0e0d; background: var(--amber); border-radius: 50%; }
.post-play:hover span { color: var(--amber); }
.post-video figcaption a { color: var(--dim); font-size: 0.85rem; }

/* the post itself: the old Markdown, set for reading */
.post-body { margin-top: 1rem; font: 300 1.1rem/1.8 var(--sans); color: #ddd6ca; overflow-wrap: anywhere; }
.post-body > * + * { margin-top: 1.15em; }
.post-body h2, .post-body h3, .post-body h4 { margin-top: 1.8em; font-family: var(--serif); font-weight: 400; color: var(--text); line-height: 1.15; }
.post-body h2 { font-size: 2rem; }
.post-body h3 { font-size: 1.55rem; }
.post-body h4 { font-size: 1.25rem; }
.post-body a { color: var(--amber); }
.post-body strong { font-weight: 600; color: var(--text); }
.post-body ul, .post-body ol { padding-left: 1.4rem; }
.post-body ul { list-style: disc; }
.post-body ol { list-style: decimal; }
.post-body li + li { margin-top: 0.35em; }
.post-body blockquote { margin-inline: 0; padding: 0.2rem 0 0.2rem 1.2rem; border-left: 2px solid var(--amber); color: #c9c2b6; font-family: var(--serif); font-size: 1.25rem; }
.post-body code { font: 400 0.88em/1.5 ui-monospace, 'SF Mono', Menlo, monospace; padding: 0.15em 0.4em; border-radius: 6px; background: rgb(255 255 255 / 0.07); color: #f0e6d6; }
/* Wrap long lines visually, without changing the source indentation or what gets copied. */
.post-body pre { padding: 1.1rem 1.25rem; border-radius: 14px; border: 1px solid var(--line); background: #0f0f0f; white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.6; }
.post-body pre code { padding: 0; background: none; font-size: 0.85rem; color: #d9e8c8; }
.post-body img { max-width: 100%; height: auto; border-radius: 12px; }
/* The original Redux Saga article's centered logo and inline illustrations. */
.post-body .redux-saga-logo { display: block; margin: 3rem auto; }
.post-body .redux-inline-logo { width: auto; height: 25px; }
.post-body .redux-pros-icon, .post-body .redux-cons-icon { width: auto; height: 45px; }
.post-body .redux-pros-icon { transform: translateY(4px); }
.post-body .redux-cons-icon { transform: translateY(19px); }
.post-body table { width: 100%; border-collapse: collapse; font-size: 0.95rem; }
.post-body th, .post-body td { padding: 0.5rem 0.6rem; border-bottom: 1px solid var(--line); text-align: left; }
.post-body hr { border: 0; border-top: 1px solid var(--line); }
