:root {
  color-scheme: dark;
  --page: #0b1020;
  --header: #090e1c;
  --surface: #10182c;
  --text: #f5f7ff;
  --muted: #afb9d1;
  --accent: #a5b3ff;
  --border: #29344e;
  --focus: #9cc7ff;
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
}

:root[data-tema="claro"] {
  color-scheme: light;
  --page: #f5f7fe;
  --header: #fff;
  --surface: #fff;
  --text: #17213d;
  --muted: #4d5a77;
  --accent: #3944b6;
  --border: #d3dbed;
  --focus: #3944b6;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--page);
  color: var(--text);
  line-height: 1.6;
}

main { flex: 1; }

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

a { color: var(--accent); text-underline-offset: .22em; }

button { font: inherit; }

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

.skip-link {
  position: absolute;
  z-index: 2;
  inset: 1rem auto auto 1rem;
  padding: .65rem 1rem;
  background: var(--surface);
  transform: translateY(calc(-100% - 1.25rem));
}

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

.wrap {
  width: min(100% - 3rem, 75rem);
  margin-inline: auto;
}

.site-header {
  background: var(--header);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 1.5rem;
  min-height: 4.75rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: .65rem;
  width: fit-content;
  min-height: 44px;
  color: var(--text);
  font-size: 1.38rem;
  font-weight: 750;
  letter-spacing: -.045em;
  text-decoration: none;
  white-space: nowrap;
}

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

.main-nav, .site-footer nav {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 1.4rem;
}

.main-nav a, .site-footer nav a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  color: var(--muted);
  font-size: .94rem;
  font-weight: 550;
  text-decoration: none;
}

.main-nav a:hover, .site-footer nav a:hover { color: var(--text); }

.main-nav [aria-current="page"], .site-footer [aria-current="page"] {
  color: var(--text);
  text-decoration: underline;
  text-decoration-color: var(--accent);
  text-underline-offset: .48em;
}

.icon {
  flex: none;
  width: 1.2em;
  height: 1.2em;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.65;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.theme-toggle {
  justify-self: end;
  display: inline-grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 1px solid var(--border);
  border-radius: .75rem;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
}

.theme-toggle[hidden],
.theme-moon,
[data-tema="claro"] .theme-sun { display: none; }

[data-tema="claro"] .theme-moon { display: block; }

.theme-toggle:hover { border-color: var(--accent); }

.hero {
  --focus: #9cc7ff;
  background-color: #080d1c;
  background-image:
    linear-gradient(90deg, #080d1c 0%, rgba(8, 13, 28, .97) 14%, rgba(8, 13, 28, .74) 49%, rgba(8, 13, 28, .23) 70%, transparent 83%),
    url("orbita.webp");
  background-size: cover, auto max(100%, 62rem);
  background-position: center, right 48%;
  background-repeat: no-repeat;
  color: #f5f7ff;
  border-bottom: 1px solid #26324f;
}

.hero-inner {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-start;
  min-height: clamp(32rem, 43vw, 39rem);
  padding-block: 4.25rem;
}

h1, h2, h3, p { margin: 0; }

.hero h1, .inner-page h1 {
  font-size: clamp(2.9rem, 6vw, 5.4rem);
  line-height: 1.02;
  letter-spacing: -.066em;
  text-wrap: balance;
}

.hero h1 span {
  color: #a9b4ff;
  background: linear-gradient(100deg, #76adff 8%, #bda4ff 95%);
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero p {
  max-width: 32rem;
  margin-top: 1.5rem;
  color: #c2cce4;
  font-size: clamp(1.06rem, 2vw, 1.24rem);
}

.actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: .75rem;
  margin-top: 2rem;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .65rem;
  min-height: 48px;
  padding: .65rem 1.1rem;
  border: 1px solid transparent;
  border-radius: .65rem;
  font-weight: 700;
  font-size: .94rem;
  text-decoration: none;
}

.primary { background: #454ad9; color: #fff; }
.primary:hover { background: #373ab9; }

.secondary {
  border-color: var(--border);
  background: var(--surface);
  color: var(--text);
}

.hero .secondary {
  border-color: #414e70;
  background: #121b31;
  color: #f5f7ff;
}

.secondary:hover, .hero .secondary:hover { border-color: var(--focus); }

.projects {
  padding-block: clamp(3rem, 6vw, 5.5rem);
}

.section-heading {
  display: flex;
  align-items: center;
  gap: .9rem;
  margin-bottom: 1.5rem;
}

.section-icon {
  display: grid;
  place-items: center;
  flex: none;
  width: 44px;
  height: 44px;
  border: 1px solid var(--border);
  border-radius: .8rem;
  background: var(--surface);
  color: var(--accent);
}

.section-heading h2 {
  font-size: clamp(1.6rem, 3.6vw, 2.75rem);
  line-height: 1.12;
  letter-spacing: -.045em;
}

.project {
  display: grid;
  grid-template-columns: 1.05fr 1fr;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 1.25rem;
  background: var(--surface);
}

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

.project-image {
  width: 100%;
  height: 100%;
  min-height: 16rem;
  max-height: 22rem;
  object-fit: cover;
  background: #302014;
}

.project-content {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: start;
  padding: clamp(1.4rem, 4.5vw, 4rem);
}

.project h3 {
  font-size: clamp(1.85rem, 3.5vw, 2.8rem);
  letter-spacing: -.04em;
  line-height: 1.12;
}

.project p {
  max-width: 36ch;
  margin-top: .85rem;
  color: var(--muted);
}

.project-link {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  min-height: 44px;
  margin-top: .8rem;
  font-weight: 700;
}

.inner-page {
  padding-block: clamp(3rem, 8vw, 7rem);
  background: radial-gradient(ellipse at 90% 0%, var(--surface), var(--page) 60%);
}

.reading { max-width: 45rem; }

.inner-page h1 { font-size: clamp(2.35rem, 6vw, 4.65rem); }

.reading p {
  color: var(--muted);
  margin-top: .6rem;
}

.reading .intro {
  margin-top: 1.25rem;
  font-size: 1.2rem;
}

.reading h2 {
  margin-top: 2rem;
  font-size: 1.5rem;
  line-height: 1.25;
  letter-spacing: -.025em;
}

.reading > .button { margin-top: 1.4rem; }

.contact-details {
  margin-block: 1rem 1.5rem;
  padding: 1rem 1.25rem;
  border: 1px solid var(--border);
  border-radius: 1rem;
  background: var(--surface);
}

.contact-details div + div {
  border-top: 1px solid var(--border);
  margin-top: .7rem;
  padding-top: .7rem;
}

.contact-details dt { font-weight: 700; }

.contact-details dd { margin: 0; color: var(--muted); }

.site-footer {
  border-top: 1px solid var(--border);
  background: var(--header);
}

.footer-inner {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: .5rem 1.5rem;
  min-height: 6rem;
  padding-block: .9rem;
}

.site-footer small { color: var(--muted); }

.site-footer nav { margin-inline-start: auto; }

@media (max-width: 45rem) {
  .wrap { width: min(100% - 2rem, 75rem); }

  .header-inner {
    grid-template-columns: 1fr auto;
    gap: .15rem 1rem;
    padding-top: .55rem;
  }

  .main-nav {
    grid-area: 2 / 1 / 3 / -1;
    gap: 0 clamp(.75rem, 4vw, 1.5rem);
  }

  .theme-toggle { grid-area: 1 / 2; }

  .hero {
    background-size: cover, auto 100%;
    background-position: center, 68% center;
    background-image:
      linear-gradient(90deg, rgba(8, 13, 28, .93), rgba(8, 13, 28, .65)),
      url("orbita.webp");
  }

  .hero-inner { min-height: 29rem; }
  .hero h1 { text-wrap: wrap; }
  .desktop-break { display: none; }

  .project { grid-template-columns: 1fr; }
  .project-image { height: auto; aspect-ratio: 1.85; min-height: 0; }
  .site-footer nav { width: 100%; margin-inline-start: 0; }
}

@media (max-width: 22rem) {
  .hero h1 { font-size: clamp(2rem, 12vw, 2.65rem); }
  .main-nav a, .site-footer nav a { font-size: .89rem; }
}

@media (prefers-reduced-motion: no-preference) {
  :root { scroll-behavior: smooth; }

  .button, .theme-toggle {
    transition: background-color .18s ease, border-color .18s ease;
  }

  .hero-inner > * {
    animation: entrada .46s ease-out both;
  }

  @keyframes entrada {
    from { opacity: .4; transform: translateY(7px); }
    to { opacity: 1; transform: translateY(0); }
  }
}

@media (forced-colors: active) {
  .hero h1 span {
    background: none;
    -webkit-text-fill-color: currentColor;
  }
}
