/* =============================================================================
   rauliscoding: Raúl Gomes

   One narrow column, read top to bottom. No cards, no panels, no chrome:
   type, space and a single accent do all of the work.

   Contents
     1. Tokens
     2. Reset & base
     3. Layout
     4. Type & links
     5. Intro
     6. Sections
     7. Projects
     8. CV list
     9. Form
     10. Footer
     11. Motion & print
   ========================================================================== */

/* ── 1. Tokens ─────────────────────────────────────────────────────────── */

:root {
  --accent: #5885e1;

  --font-sans: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  --measure: 44rem;                         /* the whole site's width */
  --gutter:  clamp(1.5rem, 6vw, 2rem);
  --gap:     clamp(3.5rem, 8vw, 5rem);      /* space between sections */

  --online: #22c55e;

  --t: 140ms cubic-bezier(.22, .61, .36, 1);
}

:root,
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg:        #0a0a0b;
  --text:      #ededf0;
  --muted:     #9b9ba3;
  --faint:     #6e6e77;
  --rule:      #232327;
  --accent:    #6f9aea;                     /* lifted for contrast on near-black */
}

:root[data-theme="light"] {
  color-scheme: light;
  --bg:        #ffffff;
  --text:      #111113;
  --muted:     #55555e;
  --faint:     #86868f;
  --rule:      #e6e6e9;
  --accent:    #3f68bd;                     /* darkened for 4.5:1 on white */
}


/* ── 2. Reset & base ───────────────────────────────────────────────────── */

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: 2rem;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 1rem;
  line-height: 1.7;
  letter-spacing: -.011em;
  -webkit-font-smoothing: antialiased;
}

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

:where(input, textarea, select, button) { font: inherit; color: inherit; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 3px;
}
:focus:not(:focus-visible) { outline: none; }

::selection { background: var(--accent); color: #fff; }

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  left: var(--gutter);
  top: 0;
  transform: translateY(-150%);
  z-index: 10;
  background: var(--accent);
  color: #fff;
  padding: .55rem 1rem;
  border-radius: 0 0 6px 6px;
  font-weight: 500;
  text-decoration: none;
  transition: transform var(--t);
}
.skip-link:focus { transform: translateY(0); }

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


/* ── 3. Layout ─────────────────────────────────────────────────────────── */

.page {
  position: relative;
  width: 100%;
  max-width: var(--measure);
  margin-inline: auto;
  padding: clamp(3.5rem, 12vw, 6rem) var(--gutter) 0;
}

main > section { margin-top: var(--gap); }

/* The only floating element on the page. */
.theme-toggle {
  position: absolute;
  top: clamp(2rem, 7vw, 3rem);
  right: var(--gutter);
  display: grid;
  place-items: center;
  width: 2rem; height: 2rem;
  padding: 0;
  background: none;
  border: none;
  border-radius: 6px;
  color: var(--faint);
  cursor: pointer;
  transition: color var(--t);
}
.theme-toggle:hover { color: var(--text); }
.theme-toggle svg {
  grid-area: 1 / 1;
  width: 1.15rem; height: 1.15rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
}
:root[data-theme="dark"] .icon-sun,
:root[data-theme="light"] .icon-moon { display: none; }


/* ── 4. Type & links ───────────────────────────────────────────────────── */

h1, h2, h3 { font-weight: 600; letter-spacing: -.025em; line-height: 1.25; }
p { text-wrap: pretty; }

a { color: var(--text); text-decoration-color: var(--rule); text-underline-offset: .2em; }
a:hover { text-decoration-color: var(--accent); }

/* Quiet secondary links: LinkedIn, Email, footer. */
.plain {
  color: var(--muted);
  text-decoration: none;
  border-bottom: 1px solid var(--rule);
  padding-bottom: 1px;
  transition: color var(--t), border-color var(--t);
}
.plain:hover { color: var(--text); border-bottom-color: var(--accent); }

.meta {
  font-family: var(--font-mono);
  font-size: .78rem;
  font-weight: 400;
  letter-spacing: 0;
  color: var(--faint);
  white-space: nowrap;
}

.stack {
  font-family: var(--font-mono);
  font-size: .78rem;
  color: var(--faint);
  margin-top: .6rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  padding: .5rem 1.1rem;
  border: 1px solid var(--accent);
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-size: .92rem;
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
  transition: opacity var(--t), transform var(--t);
}
.btn:hover { opacity: .88; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: not-allowed; }


/* ── 5. Intro ──────────────────────────────────────────────────────────── */

.intro h1 {
  font-size: clamp(2rem, 6vw, 2.6rem);
  letter-spacing: -.035em;
}

.role {
  color: var(--muted);
  font-size: .95rem;
  margin-top: .3rem;
}

.intro-lede {
  margin-top: 1.6rem;
  font-size: 1.06rem;
  color: var(--muted);
}

.availability {
  display: flex;
  align-items: center;
  gap: .55rem;
  margin-top: 1.4rem;
  font-family: var(--font-mono);
  font-size: clamp(.71rem, 2.7vw, .78rem);   /* the longest mono line on the page */
  color: var(--faint);
}
.availability .dot {
  width: .45rem; height: .45rem;
  border-radius: 50%;
  background: var(--online);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--online) 22%, transparent);
  flex: none;
}

.intro-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1.25rem;
  margin-top: 2rem;
  font-size: .92rem;
}


/* ── 6. Sections ───────────────────────────────────────────────────────── */

h2 {
  font-size: .82rem;
  font-family: var(--font-mono);
  font-weight: 500;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--faint);
  padding-bottom: .9rem;
  border-bottom: 1px solid var(--rule);
  margin-bottom: 2rem;
}

.section-lede { color: var(--muted); max-width: 38rem; }

.lines {
  list-style: none;
  padding: 0;
  display: grid;
  gap: 1.1rem;
}
.lines li { color: var(--muted); }
.lines b { color: var(--text); font-weight: 600; }


/* ── 7. Projects ───────────────────────────────────────────────────────── */

.project + .project { margin-top: 3rem; }

.screens {
  list-style: none;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: clamp(.5rem, 2vw, 1rem);
  margin-bottom: 1.4rem;
}
.screens img {
  width: 100%;
  aspect-ratio: 9 / 19;
  object-fit: cover;
  object-position: top center;
  border: 1px solid var(--rule);
  border-radius: clamp(8px, 2vw, 14px);
}

.project h3 {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: .3rem .85rem;
  font-size: 1.15rem;
  margin-bottom: .5rem;
}
.project h3 a { text-decoration: none; border-bottom: 1px solid var(--rule); }
.project h3 a:hover { border-bottom-color: var(--accent); }
.project p { color: var(--muted); }


/* ── 8. CV list ────────────────────────────────────────────────────────── */

.cv { list-style: none; padding: 0; display: grid; gap: 2.4rem; }

.cv h3 {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: .2rem .85rem;
  font-size: 1.02rem;
}

.job {
  color: var(--accent);
  font-size: .92rem;
  margin-top: .1rem;
}

.cv p:not(.job):not(.stack) {
  color: var(--muted);
  font-size: .95rem;
  margin-top: .5rem;
}


/* ── 9. Form ───────────────────────────────────────────────────────────── */

#contact-form { display: grid; gap: 1.5rem; margin-top: 2rem; }

.row { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem 2rem; }
@media (max-width: 34rem) { .row { grid-template-columns: 1fr; } }

.field { display: grid; gap: .3rem; min-width: 0; }

.field input,
.field textarea,
.field select {
  width: 100%;
  padding: .7rem 0;
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--rule);
  border-radius: 0;
  font-size: .95rem;
  transition: border-color var(--t);
}
.field textarea { resize: vertical; min-height: 6rem; line-height: 1.6; }
.field select { appearance: none; cursor: pointer; padding-right: 1.5rem;
  background-image: linear-gradient(45deg, transparent 50%, var(--faint) 50%),
                    linear-gradient(135deg, var(--faint) 50%, transparent 50%);
  background-position: right .35rem center, right .05rem center;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
}
/* Unchosen select reads as a placeholder; the open list keeps normal colours. */
.field select:has(option[value=""]:checked) { color: var(--faint); }
.field select option { color: var(--text); background: var(--bg); }

.field :is(input, textarea)::placeholder { color: var(--faint); opacity: 1; }
.field :is(input, textarea, select):hover { border-bottom-color: var(--faint); }
.field :is(input, textarea, select):focus {
  outline: none;
  border-bottom-color: var(--accent);
  box-shadow: 0 1px 0 0 var(--accent);   /* thickens the line, no box */
}

.error { font-size: .82rem; color: #e06a6a; }
:root[data-theme="light"] .error { color: #b3261e; }
.error:empty { display: none; }
.field.has-error :is(input, textarea) { border-bottom-color: #e06a6a; }
:root[data-theme="light"] .field.has-error :is(input, textarea) { border-bottom-color: #b3261e; }

/* Honeypot: off-screen, not display:none, so bots still fill it. */
.hp {
  position: absolute !important;
  left: -9999px;
  width: 1px; height: 1px;
  overflow: hidden;
}

.submit-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .75rem 1.25rem;
  margin-top: .4rem;
}

.spinner {
  display: none;
  width: .9rem; height: .9rem;
  border: 2px solid rgba(255,255,255,.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.is-sending .spinner { display: block; }

.form-status {
  display: none;
  font-size: .9rem;
  padding: .7rem .85rem;
  border-radius: 6px;
  border: 1px solid var(--rule);
  color: var(--muted);
}
.form-status.is-visible { display: block; }
.form-status.is-ok { border-color: color-mix(in srgb, var(--accent) 45%, transparent); }
.form-status.is-error { border-color: color-mix(in srgb, #e06a6a 50%, transparent); }


/* ── 10. Footer ────────────────────────────────────────────────────────── */

footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 1rem;
  margin-top: var(--gap);
  padding: 1.75rem 0 3rem;
  border-top: 1px solid var(--rule);
  font-size: .85rem;
  color: var(--faint);
}
/* Only the link row is a flex row: the copyright line contains a <span> for
   the year, which would otherwise be spaced out as a flex item of its own. */
footer .footer-links { display: flex; gap: 1.25rem; }


/* ── 11. Motion & print ────────────────────────────────────────────────── */

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}

@media (prefers-contrast: more) {
  :root { --muted: var(--text); --rule: var(--faint); }
}

@media print {
  .theme-toggle, #contact-form, .skip-link { display: none; }
  body { background: #fff; color: #000; }
  .page { max-width: none; }
}
