/* vitorcesco.com — bento layout in a native-iOS visual language.
   Used by _layouts/home.html only; helvault pages keep the remote theme. */

:root {
  color-scheme: light dark;

  --bg: light-dark(#eef1fb, #0b0d1a);
  --text: light-dark(#14151c, #f4f5fb);
  --muted: light-dark(#5d6275, #9ea3b8);
  --tile: light-dark(rgb(255 255 255 / 0.62), rgb(28 31 48 / 0.55));
  --tile-border: light-dark(rgb(255 255 255 / 0.9), rgb(255 255 255 / 0.09));
  /* light-dark() only accepts colors, so the shadow switches via its color. */
  --shadow-color: light-dark(rgb(20 24 60 / 0.16), rgb(0 0 0 / 0.55));
  --tile-shadow: 0 1px 2px color-mix(in srgb, var(--shadow-color) 30%, transparent), 0 12px 40px -12px var(--shadow-color);
  --chip: light-dark(rgb(20 24 60 / 0.06), rgb(255 255 255 / 0.08));
  --accent: light-dark(#0064e8, #4c9dff);
  --accent-fill: light-dark(#0064e8, #1668dc); /* button fills: ≥4.5:1 against white text */
  --accent-2: light-dark(#7a4dff, #a585ff);
  --on-accent: #fff;
  --blob-1: light-dark(#9ec3ff, #1d3f8f);
  --blob-2: light-dark(#c9b4ff, #4a2a8f);
  --blob-3: light-dark(#ffd1e8, #0f5a6b);

  --radius: 24px;
  --gap: 16px;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Inter", "Segoe UI", Roboto, system-ui, sans-serif;
  --font-display: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Inter", "Segoe UI", Roboto, system-ui, sans-serif;
}

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

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

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  font: 400 16px/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

a {
  color: var(--accent);
  text-decoration: none;
}

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

h1,
h2 {
  font-family: var(--font-display);
  letter-spacing: -0.02em;
}

h2 {
  font-size: 1.375rem;
  font-weight: 700;
}

h3 {
  margin-top: 1.25rem;
  margin-bottom: 0.5rem;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

.icon {
  width: 1.1em;
  height: 1.1em;
  flex: none;
  vertical-align: -0.15em;
}

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

.small {
  font-size: 0.875rem;
}

/* Mesh-gradient backdrop, painted on <html> (not a fixed layer) so it covers
   the whole canvas. Desktop browsers honor `fixed`; iOS ignores it and scrolls
   it with the page, so the top blobs use pixel offsets to stay near the top. */
html {
  --mesh:
    radial-gradient(40vmax 40vmax at 10% 90px, color-mix(in srgb, var(--blob-1) 90%, var(--bg)), transparent 70%),
    radial-gradient(45vmax 45vmax at 90% 180px, color-mix(in srgb, var(--blob-2) 90%, var(--bg)), transparent 70%),
    radial-gradient(40vmax 40vmax at 50% 100%, color-mix(in srgb, var(--blob-3) 90%, var(--bg)), transparent 70%);
  min-height: 100%;
  background: var(--mesh), var(--bg);
  background-attachment: fixed;
}

/* iOS Safari fills the strips behind its status bar and address bar with the
   flat background color, so fade the page's top and bottom edges into it. */
@supports (-webkit-touch-callout: none) {
  html {
    background:
      linear-gradient(var(--bg), transparent 96px),
      linear-gradient(to top, var(--bg), transparent 96px),
      var(--mesh),
      var(--bg);
  }
}

/* Layout */
.page {
  width: min(1120px, 100%);
  margin: 0 auto;
  padding: max(24px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) 24px max(16px, env(safe-area-inset-left));
}

.bento {
  display: grid;
  gap: var(--gap);
  grid-template-columns: repeat(4, minmax(0, 1fr));
  grid-template-areas:
    "hero hero hero stat"
    "hero hero hero links"
    "now  loc  app  app"
    "time time time skills"
    "edu  edu  edu  skills";
  align-items: start;
}

.bento--single {
  grid-template-columns: minmax(0, 640px);
  grid-template-areas: "hero";
  justify-content: center;
  min-height: 80vh;
  align-content: center;
}

.tile--hero { grid-area: hero; align-self: stretch; }
.tile--stat { grid-area: stat; align-self: stretch; }
.tile--links { grid-area: links; align-self: stretch; }
.tile--now { grid-area: now; align-self: stretch; }
.tile--location { grid-area: loc; align-self: stretch; }
.tile--app { grid-area: app; align-self: stretch; }
.tile--timeline { grid-area: time; }
.tile--skills { grid-area: skills; }
.tile--education { grid-area: edu; }

@media (max-width: 960px) {
  .bento {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-template-areas:
      "hero hero"
      "stat links"
      "now  loc"
      "app  app"
      "time time"
      "edu  edu"
      "skills skills";
  }
}

@media (max-width: 640px) {
  .bento {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas: "hero" "stat" "links" "now" "loc" "app" "time" "edu" "skills";
  }
}

/* Tiles */
.tile {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 24px;
  border-radius: var(--radius);
  background: var(--tile);
  border: 1px solid var(--tile-border);
  box-shadow: var(--tile-shadow);
  -webkit-backdrop-filter: blur(24px) saturate(160%);
  backdrop-filter: blur(24px) saturate(160%);
  animation: rise 0.6s cubic-bezier(0.2, 0.8, 0.2, 1) both;
  animation-delay: calc(var(--i, 0) * 60ms);
  transition: transform 0.3s cubic-bezier(0.2, 0.8, 0.2, 1), box-shadow 0.3s;
}

@media (hover: hover) {
  .tile:hover {
    transform: translateY(-3px);
  }
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.98);
  }
}

.eyebrow {
  display: flex;
  align-items: center;
  gap: 0.4em;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--muted);
}

/* Hero */
.tile--hero {
  justify-content: center;
  gap: 0.75rem;
  padding: clamp(24px, 5vw, 48px);
}

.hero-heading {
  display: flex;
  align-items: center;
  gap: 16px;
}

.avatar {
  flex: none;
  width: clamp(72px, 10vw, 120px);
  height: auto;
  aspect-ratio: 1;
  margin-left: -8px;
  object-fit: contain;
  filter: drop-shadow(0 10px 18px rgb(0 0 0 / 0.18));
}

.tile--hero h1 {
  font-size: clamp(2rem, 5.5vw, 4rem);
  font-weight: 800;
  line-height: 1.02;
  letter-spacing: -0.04em;
}

.hero-title {
  font-size: clamp(1.125rem, 2.4vw, 1.375rem);
  font-weight: 600;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  width: fit-content;
}

.hero-tagline {
  font-size: 1.0625rem;
  color: var(--muted);
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.625rem;
  margin-top: 0.75rem;
}

.button {
  display: inline-flex;
  align-items: center;
  gap: 0.45em;
  padding: 0.7em 1.15em;
  border-radius: 999px;
  background: var(--chip);
  color: var(--text);
  font-weight: 600;
  font-size: 0.9375rem;
  transition: transform 0.2s, filter 0.2s;

  &:hover {
    filter: brightness(1.08);
  }

  &:active {
    transform: scale(0.97);
  }
}

.button--primary {
  background: var(--accent-fill);
  color: var(--on-accent);
}

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

/* Stat */
.tile--stat {
  justify-content: flex-end;
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--accent) 16%, transparent), color-mix(in srgb, var(--accent-2) 16%, transparent)),
    var(--tile);
}

.stat-number {
  font: 800 clamp(3rem, 7vw, 4.5rem)/1 var(--font-display);
  letter-spacing: -0.05em;

  & span {
    color: var(--accent);
  }
}

.stat-label {
  color: var(--muted);
  font-weight: 500;
}

/* Links */
.tile--links {
  justify-content: center;
  gap: 0.25rem;
  padding: 12px;
}

.link-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.7rem 0.75rem;
  border-radius: 14px;
  color: var(--text);
  font-weight: 600;
  transition: background 0.2s;

  & span {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  & .icon:last-child {
    color: var(--muted);
    width: 0.9em;
  }

  &:hover {
    background: var(--chip);
  }
}

/* Now + location */
.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #34c759;
  box-shadow: 0 0 0 4px color-mix(in srgb, #34c759 25%, transparent);
}

.now-company,
.location-country {
  margin-top: auto;
  font: 700 1.5rem/1.2 var(--font-display);
  letter-spacing: -0.02em;
}

/* Map */
.tile--location {
  min-height: 250px;
  overflow: hidden;

  & > p {
    position: relative;
  }

  & > p:not(.eyebrow) {
    max-width: 9.5rem;
  }
}

/* The map fills the tile; the text sits over the empty Pacific in the lower left. */
.map {
  position: absolute;
  top: 44px;
  right: 12px;
  height: calc(100% - 56px);
  width: auto;
  max-width: calc(100% - 24px);
  -webkit-mask-image: linear-gradient(30deg, transparent 8%, #000 38%);
  mask-image: linear-gradient(30deg, transparent 8%, #000 38%);
  stroke-linecap: round;
  fill: none;
  pointer-events: none;
}

.map-land {
  stroke: var(--muted);
  stroke-width: 3.4;
  opacity: 0.3;
}

.map-country {
  stroke: var(--accent);
  stroke-width: 3.4;
}

.map-pin {
  fill: var(--accent);
  stroke: var(--bg);
  stroke-width: 2;
}

.map-pulse {
  fill: var(--accent);
  transform-box: fill-box;
  transform-origin: center;
  animation: pulse 2.4s ease-out infinite;
}

@keyframes pulse {
  from {
    opacity: 0.5;
    transform: scale(1);
  }
  to {
    opacity: 0;
    transform: scale(3.5);
  }
}

/* App */
.app-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin: 0.25rem 0;
}

.app-icon {
  width: 64px;
  height: 64px;
  border-radius: 22.5%;
  box-shadow: 0 6px 18px -6px rgb(0 0 0 / 0.35);
}

/* Timeline */
.tile-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
}

.text-link {
  display: inline-flex;
  align-items: center;
  gap: 0.3em;
  font-weight: 600;
}

.summary {
  color: var(--muted);
  max-width: 70ch;
}

.timeline {
  list-style: none;
  margin: 0.75rem 0 0;
  padding: 0;
  display: grid;
  gap: 0.5rem;

  & > li {
    position: relative;
    padding-left: 1.5rem;
  }

  & > li::before {
    content: "";
    position: absolute;
    left: 4px;
    top: 1.35rem;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--accent);
    box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 20%, transparent);
  }

  & > li:not(:last-child)::after {
    content: "";
    position: absolute;
    left: 8px;
    top: 2.2rem;
    bottom: -1rem;
    width: 2px;
    background: var(--chip);
  }
}

details {
  border-radius: 16px;
  transition: background 0.2s;

  &[open]:not(.closing),
  &:hover {
    background: var(--chip);
  }

  & summary {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 0.1rem 1rem;
    padding: 0.85rem 1rem;
    cursor: pointer;
    list-style: none;

    &::-webkit-details-marker {
      display: none;
    }

    & .icon {
      grid-column: 2;
      grid-row: 1 / span 3;
      align-self: center;
      color: var(--muted);
      transition: transform 0.25s;
    }
  }

  &[open]:not(.closing) summary .icon {
    transform: rotate(90deg);
  }

  & ul {
    margin: 0;
    padding: 0 1rem 1rem 2.25rem;
    display: grid;
    gap: 0.4rem;
    color: var(--muted);
  }
}

.timeline-dates {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}

.timeline-role {
  font-weight: 700;
  font-size: 1.0625rem;
}

.timeline-company {
  font-weight: 500;
}

.previous {
  margin: 0;
  padding-left: 1.25rem;
  color: var(--muted);
  display: grid;
  gap: 0.25rem;
}

/* Chips */
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin: 0;
  padding: 0;
  list-style: none;

  & li {
    padding: 0.3em 0.75em;
    border-radius: 999px;
    background: var(--chip);
    font-size: 0.875rem;
    font-weight: 500;
  }
}

.plain {
  margin: 0.5rem 0 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 0.75rem;
}

/* 404 */
.tile--404 {
  text-align: center;
  align-items: center;

  & h1 {
    font-size: clamp(2rem, 6vw, 3rem);
  }

  & .actions {
    justify-content: center;
  }
}

/* Footer */
.page-footer {
  padding: 8px 16px 32px;
  text-align: center;
  font-size: 0.8125rem;
  color: var(--muted);
}

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

  .map-pulse {
    display: none;
  }
}

@media print {
  .actions,
  .tile--links,
  .page-footer {
    display: none;
  }

  .bento {
    display: block;
  }

  .tile {
    box-shadow: none;
    border: none;
    background: none;
    padding: 0 0 1rem;
  }

  details > ul {
    display: grid !important;
  }
}
