/* ==========================================================================
   Marcos Ferrs — Portfolio
   Minimalist black + white "spec sheet" design system. Plain CSS, no
   preprocessor, no framework.
   ========================================================================== */

:root {
  /* surfaces */
  --bg: #000000;
  --bg-elevated: #070707;
  --bg-card-solid: #050505;
  --border: #3a3a3a;
  --border-soft: #232323;
  --grid-line: rgba(255, 255, 255, 0.07);

  /* text */
  --text: #ffffff;
  --text-muted: #999999;
  --text-faint: #666666;

  /* type */
  --font-body: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-display: "Space Grotesk", "Inter", -apple-system, sans-serif;
  --font-mono: "JetBrains Mono", "SFMono-Regular", Menlo, Consolas, monospace;

  --radius-s: 0;
  --radius-m: 0;
  --radius-l: 0;

  --shadow-card: 0 20px 40px -20px rgba(0, 0, 0, 0.8);
  --header-h: 68px;
  --drawer-w: 460px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: calc(var(--header-h) + 16px); }

body {
  margin: 0;
  background-color: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

body.no-scroll { overflow: hidden; }

/* the page shell shrinks (not overlays) when the résumé drawer opens */
.page-shell {
  width: 100%;
  overflow-x: hidden;
  transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}
body.resume-open .page-shell {
  width: calc(100% - min(var(--drawer-w), 100vw));
}

/* caps the desktop layout at 1920px on wide monitors; lateral lines mark the edge */
.page-frame {
  max-width: 1920px;
  margin: 0 auto;
  border-left: 1px solid var(--border-soft);
  border-right: 1px solid var(--border-soft);
}

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

a { color: inherit; text-decoration: none; }

.container {
  width: 100%;
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 24px;
}

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 600;
  line-height: 1.2;
  margin: 0;
}

p { margin: 0; }

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

/* -------------------------------------------------------------------- */
/* Buttons                                                               */
/* -------------------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 13px 24px;
  border-radius: var(--radius-s);
  font-size: 0.92rem;
  font-weight: 600;
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform 0.15s ease, background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
  white-space: nowrap;
}
.btn:hover { transform: translateY(-2px); }

.btn--primary {
  background: #ffffff;
  color: #000000;
}
.btn--primary:hover { background: #d9d9d9; }

.btn--ghost {
  background: transparent;
  border-color: var(--border);
  color: var(--text);
}
.btn--ghost:hover { border-color: #ffffff; }

.btn--small { padding: 10px 18px; font-size: 0.85rem; margin-top: 20px; }

/* -------------------------------------------------------------------- */
/* Header                                                                */
/* -------------------------------------------------------------------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  height: var(--header-h);
  display: flex;
  align-items: center;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid transparent;
  transition: border-color 0.2s ease, background 0.2s ease;
}
.site-header.is-scrolled {
  border-bottom-color: var(--border-soft);
  background: rgba(0, 0, 0, 0.92);
}

.header-inner {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.logo {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.15rem;
  letter-spacing: 0.02em;
}

.header-actions {
  position: absolute;
  top: 50%;
  right: 0;
  transform: translateY(-50%);
  display: flex;
  align-items: center;
  gap: 14px;
}

.social-links {
  display: flex;
  align-items: center;
  gap: 6px;
  padding-right: 8px;
  border-right: 1px solid var(--border-soft);
}
.social-links a {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  color: var(--text-muted);
  transition: color 0.15s ease, background 0.15s ease;
}
.social-links a:hover { color: var(--text); background: var(--bg-elevated); }

.lang-switch {
  display: flex;
  border: 1px solid var(--border);
  padding: 3px;
  gap: 2px;
}
.lang-switch button {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: none;
  background: transparent;
  font-size: 1.05rem;
  line-height: 1;
  padding: 0;
  cursor: pointer;
  opacity: 0.5;
  filter: grayscale(70%);
  transition: opacity 0.15s ease, filter 0.15s ease, background 0.15s ease, transform 0.15s ease;
}
.lang-switch button:hover { opacity: 0.85; filter: grayscale(20%); }
.lang-switch button.is-active {
  opacity: 1;
  filter: grayscale(0%);
  background: var(--bg-card-solid);
  box-shadow: 0 0 0 1px #ffffff inset;
}

/* -------------------------------------------------------------------- */
/* Hero — compact intro band, not a full-page hero                      */
/* -------------------------------------------------------------------- */
.hero {
  border-top: 1px solid var(--border-soft);
  border-bottom: 1px solid var(--border-soft);
}

.hero-inner {
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  gap: 40px;
  align-items: end;
  padding-top: 56px;
  padding-bottom: 56px;
}

.hero-side {
  border-left: 1px solid var(--border-soft);
  padding-left: 40px;
}

.hero-eyebrow {
  display: inline-block;
  color: var(--text-faint);
  font-family: var(--font-mono);
  font-weight: 500;
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 14px;
  padding: 5px 10px;
  border: 1px solid var(--border-soft);
}

.hero-name {
  font-size: clamp(2rem, 4vw, 2.75rem);
  letter-spacing: -0.02em;
  color: var(--text);
}

.hero-role {
  margin-top: 10px;
  font-size: clamp(0.95rem, 1.6vw, 1.08rem);
  font-weight: 500;
  color: var(--text-muted);
}

.hero-side { display: flex; flex-direction: column; align-items: flex-start; gap: 20px; }

.hero-tagline {
  color: var(--text-muted);
  font-size: 0.98rem;
  max-width: 420px;
}

.hero-ctas {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
}

/* -------------------------------------------------------------------- */
/* Sections                                                              */
/* -------------------------------------------------------------------- */
.section { padding: 88px 0; border-bottom: 1px solid var(--border-soft); }
.section:last-of-type { border-bottom: none; }

.section-title {
  font-size: clamp(1.7rem, 3.6vw, 2.2rem);
  margin-bottom: 40px;
}

[data-reveal] {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}
[data-reveal].is-visible { opacity: 1; transform: translateY(0); }

/* -------------------------------------------------------------------- */
/* Resume                                                                */
/* -------------------------------------------------------------------- */
.resume-block { margin-top: 56px; }
.resume-block h3 {
  font-size: 1.25rem;
  margin-bottom: 20px;
  color: var(--text);
}
.resume-block h3::before {
  content: "";
  display: inline-block;
  width: 8px;
  height: 8px;
  background: #ffffff;
  margin-right: 10px;
  transform: translateY(-1px);
}

.resume-summary p {
  color: var(--text-muted);
  max-width: 760px;
  font-size: 1.02rem;
}
.resume-summary h3 { font-size: 1.25rem; margin-bottom: 14px; }

.resume-grid-2 {
  margin-top: 56px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 40px;
}

.skill-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
}

.skill-card {
  background: var(--bg-card-solid);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-m);
  padding: 20px;
  transition: border-color 0.2s ease, transform 0.2s ease;
}
.skill-card:hover { border-color: #ffffff; transform: translateY(-3px); }
.skill-card h4 {
  font-size: 0.95rem;
  color: var(--text);
  margin-bottom: 8px;
}
.skill-card p {
  font-size: 0.88rem;
  color: var(--text-muted);
  margin: 0;
}

.plain-list li {
  padding: 12px 0;
  border-bottom: 1px solid var(--border-soft);
  color: var(--text-muted);
  font-size: 0.95rem;
}
.plain-list li:last-child { border-bottom: none; }
.plain-list strong { color: var(--text); }

/* timeline */
.timeline {
  position: relative;
  padding-left: 28px;
  border-left: 1px solid var(--border-soft);
  display: flex;
  flex-direction: column;
  gap: 40px;
}

.timeline-item { position: relative; }

.timeline-dot {
  position: absolute;
  left: -33px;
  top: 4px;
  width: 10px;
  height: 10px;
  background: #ffffff;
  box-shadow: 0 0 0 4px var(--bg);
}

.timeline-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px 16px;
}
.timeline-head h3 { font-size: 1.08rem; color: var(--text); }

.timeline-period {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 500;
  white-space: nowrap;
}

.timeline-meta {
  margin-top: 4px;
  color: var(--text-faint);
  font-size: 0.88rem;
}

.timeline-bullets { margin-top: 12px; display: flex; flex-direction: column; gap: 8px; }
.timeline-bullets li {
  position: relative;
  padding-left: 18px;
  color: var(--text-muted);
  font-size: 0.94rem;
  line-height: 1.55;
}
.timeline-bullets li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 9px;
  width: 5px;
  height: 5px;
  background: var(--text-muted);
}

.education-desc {
  margin-top: 10px;
  color: var(--text-muted);
  font-size: 0.94rem;
}

/* -------------------------------------------------------------------- */
/* Portfolio — big grid of rectangles, title-forward "spec sheet" style */
/* -------------------------------------------------------------------- */
.portfolio-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  grid-auto-rows: 220px;
  grid-auto-flow: dense;
  gap: 1px;
  background: var(--border-soft);
  border: 1px solid var(--border-soft);
}

.portfolio-card--lg {
  grid-column: span 2;
  grid-row: span 2;
}

.portfolio-card--wide {
  grid-column: span 2;
  grid-row: span 1;
}

.portfolio-card {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: flex-start;
  text-align: left;
  padding: 0;
  background: #000000;
  border: 0;
  overflow: hidden;
  cursor: pointer;
  font-family: var(--font-body);
  color: var(--text);
}

.portfolio-thumb { position: absolute; inset: 0; }
.portfolio-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top center;
}

.portfolio-info {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  background: #ffffff;
  padding: 10px 14px;
  max-width: 100%;
}

.portfolio-tag {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: rgba(0, 0, 0, 0.55);
}

.portfolio-title {
  font-family: var(--font-display);
  font-size: 1.3rem;
  font-weight: 600;
  color: #000000;
}

/* -------------------------------------------------------------------- */
/* Footer                                                                */
/* -------------------------------------------------------------------- */
.site-footer {
  border-top: 1px solid var(--border-soft);
  padding: 28px 0;
}
.footer-inner {
  display: flex;
  justify-content: center;
  color: var(--text-faint);
  font-size: 0.85rem;
}
.made-with {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.claude-mark { flex-shrink: 0; }

/* -------------------------------------------------------------------- */
/* Modal (project details)                                              */
/* -------------------------------------------------------------------- */
.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.modal[hidden] { display: none; }

.modal-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  opacity: 0;
  transition: opacity 0.2s ease;
}

.modal-panel {
  position: relative;
  z-index: 1;
  width: min(640px, 92vw);
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  background: var(--bg-card-solid);
  border: 1px solid var(--border);
  box-shadow: 0 30px 80px -20px rgba(0, 0, 0, 0.9);
  opacity: 0;
  transform: translateY(16px) scale(0.98);
  transition: opacity 0.2s ease, transform 0.2s ease;
  overflow: hidden;
}

.modal.is-open .modal-overlay { opacity: 1; }
.modal.is-open .modal-panel { opacity: 1; transform: translateY(0) scale(1); }

.modal-preview {
  width: 100%;
  aspect-ratio: 16 / 9;
  flex-shrink: 0;
  object-fit: cover;
  object-position: top center;
  background: var(--bg-elevated);
}

.modal-body {
  padding: 24px;
  overflow-y: auto;
  flex: 1;
}
.modal-body h3 { font-size: 1.4rem; margin-top: 6px; }

.modal-tag {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.modal-desc {
  margin-top: 14px;
  color: var(--text-muted);
  font-size: 0.96rem;
  line-height: 1.6;
}

.modal-proto-links {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 20px;
}

.modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  z-index: 2;
  border: 1px solid rgba(255, 255, 255, 0.5);
  background: rgba(0, 0, 0, 0.55);
  color: #ffffff;
  width: 34px;
  height: 34px;
  font-size: 1.2rem;
  line-height: 1;
  cursor: pointer;
  flex-shrink: 0;
  transition: color 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}
.modal-close:hover { color: #000000; background: #ffffff; border-color: #ffffff; }

/* -------------------------------------------------------------------- */
/* Résumé drawer — docks right, slides right-to-left; the page shell    */
/* shrinks instead of a darkening overlay blocking navigation.          */
/* -------------------------------------------------------------------- */
.modal--drawer {
  justify-content: flex-end;
  padding: 0;
}
.modal--drawer .modal-overlay {
  background: transparent;
}

.drawer-panel {
  position: relative;
  z-index: 1;
  width: min(var(--drawer-w), 100vw);
  height: 100%;
  max-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg-card-solid);
  border-left: 1px solid var(--border);
  box-shadow: -30px 0 80px -20px rgba(0, 0, 0, 0.8);
  opacity: 0;
  transform: translateX(100%);
  transition: opacity 0.3s ease, transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.modal--drawer.is-open .drawer-panel { opacity: 1; transform: translateX(0); }

.drawer-header {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 22px 24px;
  background: var(--bg-card-solid);
  border-bottom: 1px solid var(--border-soft);
}
.drawer-header h3 { font-size: 1.35rem; }

.drawer-body {
  padding: 24px;
  overflow-y: auto;
  flex: 1;
}
.drawer-body .resume-summary { margin-top: 0; }
.drawer-body .resume-block:first-of-type { margin-top: 40px; }

/* -------------------------------------------------------------------- */
/* Responsive                                                            */
/* -------------------------------------------------------------------- */
@media (max-width: 860px) {
  .resume-grid-2 { grid-template-columns: 1fr; }
  .hero-inner { grid-template-columns: 1fr; align-items: start; }
  .hero-side { border-left: none; border-top: 1px solid var(--border-soft); padding-left: 0; padding-top: 28px; margin-top: 8px; }
}

@media (max-width: 760px) {
  :root { --header-h: 60px; }

  .lang-switch button { width: 28px; height: 28px; font-size: 0.95rem; }

  .section { padding: 64px 0; }

  .modal { padding: 0; }
  .modal-panel { width: 100%; max-height: 100%; height: 100%; }
  .modal-body { overflow-y: auto; }

  body.resume-open .page-shell { width: 0; }
}

@media (max-width: 1100px) {
  .portfolio-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 480px) {
  .hero-ctas { flex-direction: column; width: 100%; }
  .hero-ctas .btn { width: 100%; }
  .portfolio-grid { grid-template-columns: 1fr; grid-auto-rows: 260px; }
  .portfolio-card--lg { grid-column: span 1; grid-row: span 2; }
  .portfolio-card--wide { grid-column: span 1; grid-row: span 1; }
}
