/* ==========================================================================
   Portfolio · Jorge Fuentes Aguilar
   Tema oscuro minimalista con estética "dev / terminal"
   Estilos globales compartidos por index.html y contacto.html
   ========================================================================== */


/* --------------------------------------------------------------------------
   1. Variables
   -------------------------------------------------------------------------- */
:root {
  color-scheme: dark;

  /* Superficies */
  --bg: #0b0f14;
  --surface: #12171f;
  --border: #21262d;
  --border-strong: #30363d;

  /* Texto */
  --text: #e6edf3;
  --text-soft: #b1bac4;
  --text-muted: #8b949e;

  /* Verde terminal suave */
  --accent: #3fb950;         /* enlaces, etiquetas y foco */
  --accent-strong: #2ea043;  /* botón principal y detalles decorativos */
  --accent-bg: rgba(63, 185, 80, 0.08);
  --accent-border: rgba(63, 185, 80, 0.28);

  /* Aviso "en desarrollo": amarillo dorado sutil */
  --warning: #e3b341;
  --warning-bg: rgba(227, 179, 65, 0.1);
  --warning-border: rgba(227, 179, 65, 0.3);

  /* Tipografía */
  --font-sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;

  /* Layout */
  --max-width: 62.5rem;
  --max-width-narrow: 40rem;
  --gutter: clamp(1.25rem, 5vw, 2rem);
  --radius: 8px;
}


/* --------------------------------------------------------------------------
   2. Base
   -------------------------------------------------------------------------- */
*,
*::before,
*::after {
  box-sizing: border-box;
}

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

body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 1rem;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

main {
  flex: 1;
}

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

a {
  color: inherit;
}

::selection {
  background: var(--accent-border);
  color: var(--text);
}

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


/* --------------------------------------------------------------------------
   3. Layout
   -------------------------------------------------------------------------- */
.container {
  width: 100%;
  max-width: var(--max-width);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

/* Columna estrecha para la página de contacto */
.container--narrow {
  max-width: var(--max-width-narrow);
}


/* --------------------------------------------------------------------------
   4. Botones
   -------------------------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  min-height: 2.75rem;
  padding: 0.55rem 1.1rem;
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  background: transparent;
  color: var(--accent);
  font: inherit;
  font-size: 0.9375rem;
  font-weight: 500;
  line-height: 1.2;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.2s ease, border-color 0.2s ease;
}

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

/* Acción principal (botón de envío del formulario) */
.btn--primary {
  background: var(--accent-strong);
  border-color: var(--accent-strong);
  color: var(--bg);
  font-weight: 600;
}

.btn--primary:hover {
  background: var(--accent);
  border-color: var(--accent);
}


/* --------------------------------------------------------------------------
   5. Cabecera (hero)
   -------------------------------------------------------------------------- */
.hero {
  padding-block: clamp(4rem, 12vw, 7.5rem) clamp(3rem, 8vw, 5rem);
}

.hero__prompt {
  margin-bottom: 1.25rem;
  font-family: var(--font-mono);
  font-size: 0.875rem;
  color: var(--text-muted);
}

.hero__prompt span {
  color: var(--accent-strong);
}

.hero__name {
  font-size: clamp(2.25rem, 6vw, 3.5rem);
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.025em;
  text-wrap: balance;
}

.hero__subtitle {
  margin-top: 0.75rem;
  font-size: clamp(1rem, 2.2vw, 1.2rem);
  color: var(--text-soft);
}

.hero__intro {
  max-width: 38rem;
  margin-top: 1.5rem;
  color: var(--text-soft);
}

.hero__links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 2rem;
}


/* --------------------------------------------------------------------------
   6. Sección de proyectos
   -------------------------------------------------------------------------- */
.section {
  padding-bottom: clamp(4rem, 10vw, 6rem);
}

.section__title {
  margin-bottom: 1.5rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border);
  font-family: var(--font-mono);
  font-size: 0.9375rem;
  font-weight: 500;
}

.section__title span {
  color: var(--accent-strong);
}

/* Rejilla: 1 columna en móvil y 2 desde tablet */
.projects {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 1rem;
}

@media (min-width: 40em) {
  .projects {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  /* Si queda una tarjeta suelta en la última fila, ocupa todo el ancho */
  .project:last-child:nth-child(odd) {
    grid-column: 1 / -1;
  }
}


/* --------------------------------------------------------------------------
   7. Tarjetas de proyecto
   -------------------------------------------------------------------------- */
.project {
  display: flex;
  flex-direction: column;
  padding: 1.5rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: border-color 0.2s ease;
}

.project:hover {
  border-color: var(--border-strong);
}

.project__kind {
  margin-bottom: 0.75rem;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  line-height: 1.5rem;
  letter-spacing: 0.02em;
  color: var(--text-muted);
}

/* Cabecera con categoría y etiqueta de estado (misma altura que .project__kind solo) */
.project__header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.25rem 0.75rem;
  margin-bottom: 0.75rem;
}

.project__header .project__kind {
  margin-bottom: 0;
}

.project__title {
  margin-bottom: 0.625rem;
  font-size: 1.1875rem;
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: -0.01em;
}

/* flex: 1 empuja etiquetas y enlace al fondo, así todas las tarjetas quedan alineadas */
.project__desc {
  flex: 1;
  margin-bottom: 1.25rem;
  font-size: 0.9375rem;
  color: var(--text-soft);
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.375rem;
  margin-bottom: 1.25rem;
  padding: 0;
  list-style: none;
}

.tags li {
  padding: 0.25rem 0.5rem;
  border: 1px solid var(--accent-border);
  border-radius: 4px;
  background: var(--accent-bg);
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  line-height: 1.4;
}

.project__link {
  align-self: flex-start;
  color: var(--text-soft);
  font-size: 0.875rem;
  text-decoration: underline;
  text-decoration-color: var(--border-strong);
  text-underline-offset: 0.3em;
  transition: color 0.2s ease, text-decoration-color 0.2s ease;
}

.project__link:hover {
  color: var(--accent);
  text-decoration-color: var(--accent);
}

/* Etiqueta de estado */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.125rem 0.5rem;
  border: 1px solid transparent;
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  line-height: 1.4;
  white-space: nowrap;
}

.badge::before {
  content: "";
  width: 0.375rem;
  height: 0.375rem;
  border-radius: 50%;
  background: currentColor;
}

/* Aviso tipo terminal: amarillo dorado sutil */
.badge--warning {
  color: var(--warning);
  background: var(--warning-bg);
  border-color: var(--warning-border);
}


/* --------------------------------------------------------------------------
   8. Aviso flotante (lo crea script.js al hacer clic en un [data-notice])
   -------------------------------------------------------------------------- */
.notice {
  position: fixed;
  right: 1.25rem;
  bottom: calc(1.25rem + env(safe-area-inset-bottom, 0px));
  z-index: 100;
  width: min(26rem, calc(100vw - 2.5rem));
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.45);
  animation: notice-in 0.18s ease-out;
}

@keyframes notice-in {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

/* Barra superior, como la de una ventana de terminal */
.notice__bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.25rem 0.375rem 0.25rem 0.9rem;
  border-bottom: 1px solid var(--border);
}

.notice__title {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-muted);
}

.notice__title::before {
  content: "";
  width: 0.375rem;
  height: 0.375rem;
  border-radius: 50%;
  background: var(--warning);
}

/* Botón de cierre discreto */
.notice__close {
  display: grid;
  place-items: center;
  width: 2rem;
  height: 2rem;
  padding: 0;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--text-muted);
  font: inherit;
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
  transition: color 0.2s ease, background-color 0.2s ease;
}

.notice__close:hover {
  background: var(--border);
  color: var(--text);
}

.notice__text {
  padding: 0.85rem 1rem 1rem;
  font-size: 0.9375rem;
  line-height: 1.55;
  color: var(--text-soft);
}


/* --------------------------------------------------------------------------
   9. Página de contacto
   -------------------------------------------------------------------------- */
.page {
  padding-block: clamp(2.5rem, 8vw, 4.5rem) clamp(3rem, 8vw, 5rem);
}

.back-link {
  display: inline-block;
  margin-bottom: 2rem;
  font-family: var(--font-mono);
  font-size: 0.875rem;
  color: var(--text-soft);
  text-decoration: none;
  transition: color 0.2s ease;
}

.back-link:hover {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 0.3em;
}

.page-title {
  margin-bottom: 1rem;
  font-family: var(--font-mono);
  font-size: clamp(1.5rem, 4vw, 2rem);
  font-weight: 600;
  line-height: 1.2;
}

.page-title span {
  color: var(--accent-strong);
}

.page-intro {
  max-width: 34rem;
  margin-bottom: 2rem;
  color: var(--text-soft);
}

/* Formulario */
.form {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 1.25rem;
  padding: clamp(1.25rem, 4vw, 2rem);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  width: 100%;
}

.field label {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-soft);
}

.field input,
.field textarea {
  width: 100%;
  padding: 0.7rem 0.85rem;
  background: var(--bg);
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  color: var(--text);
  font: inherit;
  line-height: 1.5;
  transition: border-color 0.2s ease;
}

.field textarea {
  min-height: 9rem;
  resize: vertical;
}

.field ::placeholder {
  color: var(--text-muted);
  opacity: 1;
}

.field input:focus-visible,
.field textarea:focus-visible {
  border-color: var(--accent);
  outline-offset: 0;
}

/* Evita el fondo claro que aplica el autocompletado del navegador */
.field input:-webkit-autofill {
  -webkit-text-fill-color: var(--text);
  caret-color: var(--text);
  box-shadow: 0 0 0 1000px var(--bg) inset;
}


/* --------------------------------------------------------------------------
   10. Pie de página
   -------------------------------------------------------------------------- */
.footer {
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  color: var(--text-muted);
}

.footer__text {
  padding-block: 1.5rem;
  border-top: 1px solid var(--border);
}


/* --------------------------------------------------------------------------
   11. Accesibilidad: respetar "reducir movimiento"
   -------------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
}    