/* ------------------------------------------------------------------
   Robtonx — Tonatiuh Preciado, one-page CV
------------------------------------------------------------------- */

@font-face {
  font-family: "Manrope";
  src: url("../fonts/manrope-latin.woff2") format("woff2");
  font-weight: 200 800;
  font-display: swap;
}

/* static ExtraBold without overlapping contours, so outlined text stays clean */
@font-face {
  font-family: "Manrope Outline";
  src: url("../fonts/manrope-800-solid.woff2") format("woff2");
  font-weight: 800;
  font-display: swap;
}

/* ---------- themes ---------- */

:root,
[data-theme="dark"] {
  --bg: #060C1A;
  --surface: #0B1529;
  --line: rgba(148, 172, 214, 0.14);
  --line-strong: rgba(148, 172, 214, 0.26);
  --text: #F2F6FF;
  --muted: #93A4C2;
  --blue: #4D7CFE;
  --accent: #74A9FF;
  --chip-bg: rgba(116, 169, 255, 0.08);
  --chip-line: rgba(116, 169, 255, 0.22);
  --header-bg: rgba(6, 12, 26, 0.72);
  --glow: rgba(77, 124, 254, 0.26);
  color-scheme: dark;
}

[data-theme="light"] {
  --bg: #F5F7FC;
  --surface: #FFFFFF;
  --line: rgba(20, 40, 90, 0.09);
  --line-strong: rgba(20, 40, 90, 0.16);
  --text: #0C1630;
  --muted: #5A6A88;
  --blue: #3563F2;
  --accent: #2F5CE8;
  --chip-bg: rgba(53, 99, 242, 0.06);
  --chip-line: rgba(53, 99, 242, 0.2);
  --header-bg: rgba(245, 247, 252, 0.8);
  --glow: rgba(53, 99, 242, 0.14);
  color-scheme: light;
}

:root {
  --container: 64rem;
  --gutter: clamp(1.25rem, 5vw, 3rem);
  --header-h: 4.25rem;
}

/* ---------- base ---------- */

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

html {
  scroll-padding-top: var(--header-h);
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Manrope", system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 1rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.js body {
  transition: background-color 0.3s ease, color 0.3s ease;
}

a {
  color: inherit;
}

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

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

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

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

.icon {
  width: 1rem;
  height: 1rem;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.icon-fill {
  fill: currentColor;
  stroke: none;
}

.icon .dot {
  fill: currentColor;
}

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

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  border-bottom: 1px solid var(--line);
  background: var(--header-bg);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: var(--header-h);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.7rem;
  text-decoration: none;
}

.monogram {
  display: grid;
  place-items: center;
  width: 2.15rem;
  height: 2.15rem;
  border-radius: 0.6rem;
  background: linear-gradient(135deg, #7AA7FF 0%, #4D7CFE 55%, #3858E8 100%);
  box-shadow: 0 6px 18px -8px rgba(77, 124, 254, 0.8);
  color: #fff;
  font-size: 0.78rem;
  font-weight: 800;
}

.brand-name {
  font-size: 0.8125rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.lang {
  display: flex;
}

.lang button {
  appearance: none;
  border: 0;
  background: none;
  color: var(--muted);
  font: inherit;
  font-size: 0.8125rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  padding: 0.4rem 0.45rem;
  cursor: pointer;
}

.lang button:hover,
.lang button[aria-pressed="true"] {
  color: var(--text);
}

.lang button[aria-pressed="true"] {
  text-decoration: underline;
  text-decoration-color: var(--accent);
  text-decoration-thickness: 2px;
  text-underline-offset: 0.45em;
}

.theme-toggle {
  appearance: none;
  display: grid;
  place-items: center;
  width: 2.4rem;
  height: 2.4rem;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  transition: border-color 0.2s ease, background-color 0.2s ease;
}

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

.theme-toggle .icon {
  width: 1.1rem;
  height: 1.1rem;
}

/* show the icon of the mode you will switch to */
[data-theme="dark"] .icon-moon,
[data-theme="light"] .icon-sun {
  display: none;
}

/* ---------- intro ---------- */

.hero {
  position: relative;
  padding-block: clamp(4rem, 12vh, 7.5rem) clamp(3.5rem, 9vh, 5.5rem);
  overflow: hidden;
  isolation: isolate;
}

.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background-image:
    linear-gradient(var(--line) 1px, transparent 1px),
    linear-gradient(90deg, var(--line) 1px, transparent 1px);
  background-size: 64px 64px;
  -webkit-mask-image: radial-gradient(ellipse 70% 80% at 70% 30%, #000 15%, transparent 72%);
  mask-image: radial-gradient(ellipse 70% 80% at 70% 30%, #000 15%, transparent 72%);
  opacity: 0.6;
}

.hero::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -2;
  background: radial-gradient(45% 70% at 90% 10%, var(--glow), transparent 70%);
}

.eyebrow {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
  color: var(--accent);
  font-size: 0.8125rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.eyebrow-line {
  width: 2.5rem;
  height: 1px;
  background: currentColor;
  opacity: 0.8;
}

.name {
  font-size: clamp(3.25rem, 10.5vw, 7.75rem);
  font-weight: 800;
  letter-spacing: -0.045em;
  line-height: 0.98;
}

.name-solid,
.name-outline {
  display: block;
}

.name-outline {
  width: fit-content;
  margin-left: -0.04em;
  padding: 0.02em 0.12em 0.08em 0.02em;
  font-family: "Manrope Outline", "Manrope", sans-serif;
  color: var(--accent);
  transform: skewX(-12deg);
  transform-origin: left bottom;
}

@supports (-webkit-text-stroke: 1px) {
  .name-outline {
    color: transparent;
    -webkit-text-stroke: max(1.5px, 0.012em) var(--accent);
  }
}

.socials {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  margin-top: clamp(2rem, 5vh, 2.75rem);
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.6rem 1rem;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--bg);
  color: var(--text);
  font-size: 0.9375rem;
  font-weight: 600;
  line-height: 1.2;
  text-decoration: none;
  transition: border-color 0.2s ease, background-color 0.2s ease;
}

.pill:hover {
  border-color: var(--accent);
  background: var(--chip-bg);
}

/* official brand colours */
.brand {
  border-color: transparent;
  color: #fff;
  transition: transform 0.2s ease, filter 0.2s ease, box-shadow 0.2s ease;
}

.brand:hover {
  border-color: transparent;
  filter: brightness(1.08);
  transform: translateY(-2px);
}

.brand-gmail {
  background: #D93025;
  box-shadow: 0 10px 26px -14px rgba(217, 48, 37, 0.9);
}

.brand-gmail:hover {
  background: #D93025;
}

.brand-github {
  background: #24292F;
  box-shadow: 0 10px 26px -14px rgba(0, 0, 0, 0.9);
}

[data-theme="dark"] .brand-github {
  border-color: rgba(255, 255, 255, 0.18);
}

.brand-github:hover {
  background: #24292F;
}

.brand-linkedin {
  background: #0A66C2;
  box-shadow: 0 10px 26px -14px rgba(10, 102, 194, 0.9);
}

.brand-linkedin:hover {
  background: #0A66C2;
}

.brand-instagram {
  background: linear-gradient(45deg, #F58529 0%, #DD2A7B 38%, #8134AF 72%, #515BD4 100%);
  box-shadow: 0 10px 26px -14px rgba(221, 42, 123, 0.9);
}

.brand-instagram:hover {
  background: linear-gradient(45deg, #F58529 0%, #DD2A7B 38%, #8134AF 72%, #515BD4 100%);
}

@media (prefers-reduced-motion: reduce) {
  .brand:hover {
    transform: none;
  }
}

/* ---------- cv rows ---------- */

.cv {
  padding-bottom: clamp(4rem, 10vh, 6rem);
}

.cv-row {
  display: grid;
  grid-template-columns: 12rem minmax(0, 1fr);
  gap: 1rem 2rem;
  padding-block: clamp(2rem, 5vh, 2.75rem);
  border-top: 1px solid var(--line-strong);
}

.cv-label {
  padding-top: 0.2rem;
  color: var(--accent);
  font-size: 0.8125rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.about {
  max-width: 38rem;
  font-size: clamp(1.125rem, 2vw, 1.375rem);
  font-weight: 500;
  line-height: 1.55;
  letter-spacing: -0.01em;
  text-wrap: pretty;
}

/* skills */

.skills {
  display: grid;
  gap: 1.5rem;
}

.skill-group h3 {
  margin-bottom: 0.65rem;
  color: var(--muted);
  font-size: 0.9375rem;
  font-weight: 600;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.chips li {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.3rem 0.85rem 0.3rem 0.35rem;
  border: 1px solid var(--chip-line);
  border-radius: 999px;
  background: var(--chip-bg);
  font-size: 0.875rem;
  font-weight: 600;
  line-height: 1.4;
}

.chip-icon {
  display: block;
  width: 1.4rem;
  height: 1.4rem;
  border-radius: 0.35rem;
}

/* each logo has a dark and a light version; show the one that matches the theme */
[data-theme="dark"] .chip-icon[data-variant="light"],
[data-theme="light"] .chip-icon[data-variant="dark"] {
  display: none;
}

/* education + projects */

.entry {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

.entry-title {
  font-size: clamp(1.15rem, 2vw, 1.375rem);
  font-weight: 700;
  letter-spacing: -0.015em;
  line-height: 1.3;
}

.entry-meta {
  margin-top: 0.15rem;
  color: var(--muted);
  font-size: 0.9688rem;
}

.badge {
  flex: none;
  padding: 0.3rem 0.75rem;
  border-radius: 999px;
  background: var(--chip-bg);
  border: 1px solid var(--chip-line);
  color: var(--accent);
  font-size: 0.8125rem;
  font-weight: 700;
  white-space: nowrap;
}

.projects {
  display: grid;
}

.project {
  display: grid;
  grid-template-columns: 7.5rem minmax(0, 1fr);
  align-items: baseline;
  gap: 0.25rem 1.5rem;
  padding-block: 1.1rem;
  border-top: 1px solid var(--line);
}

.project:first-child {
  padding-top: 0;
  border-top: 0;
}

.project:last-child {
  padding-bottom: 0;
}

.project-tag {
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.project-link {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  text-decoration: none;
  transition: color 0.2s ease;
}

.project-link .icon-arrow {
  width: 0.95rem;
  height: 0.95rem;
  color: var(--accent);
  transition: transform 0.2s ease;
}

.project-link:hover {
  color: var(--accent);
}

.project-link:hover .icon-arrow {
  transform: translate(2px, -2px);
}

/* ---------- entrance (one moment, on load) ---------- */

@media (prefers-reduced-motion: no-preference) {
  .js .reveal {
    animation: reveal 0.85s cubic-bezier(0.2, 0.7, 0.2, 1) both;
  }

  .js .name-solid.reveal { animation-delay: 0.06s; }
  .js .name-outline.reveal { animation-delay: 0.16s; animation-name: reveal-skewed; }
  .js .socials.reveal { animation-delay: 0.28s; }

  @keyframes reveal {
    from { opacity: 0; transform: translateY(16px); }
    to { opacity: 1; transform: none; }
  }

  @keyframes reveal-skewed {
    from { opacity: 0; transform: translateY(16px) skewX(-12deg); }
    to { opacity: 1; transform: skewX(-12deg); }
  }
}

@media (prefers-reduced-motion: reduce) {
  .js body {
    transition: none;
  }
}

/* ---------- small screens ---------- */

@media (max-width: 48rem) {
  .cv-row {
    grid-template-columns: minmax(0, 1fr);
  }

}

@media (max-width: 30rem) {
  .brand-name {
    display: none;
  }

  .project {
    grid-template-columns: minmax(0, 1fr);
  }
}
